I want to assign the user name to a SESSION variable, yet this is not working.
$_SESSION['loveleytest'] = $user;
$_SESSION['thelovelytest2'] = $user->name;
What should I do?
I want to assign the user name to a SESSION variable, yet this is not working.
$_SESSION['loveleytest'] = $user;
$_SESSION['thelovelytest2'] = $user->name;
What should I do?
For assigning user_name to a session variable you would directly do something like
global $user;
$_SESSION['thelovelytest2'] = $user->name;
I think the issue with your code may be:
global $user
variable.$_SESSION['loveleytest'] = $user
, thats why the issue is there.I am also curious to know which was the exact issue.