[support] Add some info to $user

Marc Poris marc at funnymonkey.com
Wed Mar 5 17:48:10 UTC 2008


You probably need to call user_load() -- please read through this issue 
and the issues that it references:

   http://drupal.org/node/49385

- Marc



Davide Michel 'ZioBudda' Morelli wrote:
> Hi all. I need to add some infos to $user variable. I have thinked that 
> hook_user() is my "hook" :)
>
> So I have write a function that add the infos to the $account:
>
> function mw_livelloUtenti_user($op, &$edit, &$account, $category = NULL) {
>     switch ($op) {
>         case "login" :
>         case "load" :
>             if ($account->uid != NULL || $account->uid != 0) {
>                
>                 $tmp = db_query("SELECT mw.* FROM mw_lU AS mw LEFT JOIN 
> mw_lU_user AS mwu ON mw.luid = mwu.luid WHERE mwu.uid = %d",$account->uid);
>                 $account->level = db_fetch_array($tmp);
>                 //print_r($account); //Ok, data are inserted (fields: 
> level, data1, data2)
>             }
>             break;
>   }
> }
>
>
> Now, why when one of my other module try to access to $user->account 
> this field is NULL ?
> Plz help me.
>
> M.
>
>   




More information about the support mailing list