I found some similar question 1 year ago: Codeigniter Tank Auth add folder upon registration ... but not with username included. I tried to add username (of the registered person in that moment) in module, function create_user.This function create new folder with $user_id
and _
like: 1_
but without username of the registered person. I tried to include data $username
from $data
array, but hoplesss...
if($this->db->insert($this->table_name, $data)) {
$user_id = $this->db->insert_id();
$name = $username;
if(!is_dir(FCPATH."./uploads/".$user_id."_".$name)){
mkdir(FCPATH."./uploads/".$user_id."_".$name , 0777);
}
I know that $data
array has username on 1. position for DB write purpose. I tried this possiblity: $name = $username; $name = $data[0];
$name = $username; $name = $data[0];
I found that the library, Tank_auth.php has function get_username()
. It is for later purpose when the new user will log in... How can I get username from $data
or DB, table users, cell username ?
Try
$name = $data['username'];
in your code to get the name of the user.
From CodeIgniter Active Record manual , $data
is an associative array which will have table field names as keys.
From Tank Auth it is clear that users
table contains a field with the name username
to store the user's name.
Let me know if this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.