Notice: Undefined property: stdClass::$field imce drupal I'm in trouble so maybe someone can figure it out: I'm trying to have singular folder for every user in imce (drupal7) and I want that the folder is a code that I can insert with a field in user profile. (like 78M4589)

well, this code generate the folder in the right place:

return 'users/'.$user-&gt;field_code['und'][0]['value'];


but in imce on the page i have this notice:


  Notice: Undefined property: stdClass::$field_code in eval() (linea 1 di () : eval()'d code).


I really can't figure it out.
The global $user object is not guaranteed to have all the fields loaded onto it.

Try specifically loading the user like this:

global $user;
// Load the full user object.
$account = user_load($user-&gt;uid);
// Get the user code.
$code = '';
if ($items = field_get_items('user', $account, 'field_code')) {
  $code = $items[0]['value'];
}
return $code;