I need the $user object within a module am creating. But am not able to get it. I have created a module that extends user object hold more data. Its working fine. I am also able to use this values in theme files. But am not able to get it in any function within a module.
The standard value
$user->name; or my custom value
$user->data['privacy']; nothing is available in module.
I tried using this
global $user; $user = $user->name;
What is the mistake here? Is it that global is not the right way to get the user object?