function messaging_load_user in Messaging 6.4
Same name and namespace in other branches
- 5 messaging.module \messaging_load_user()
- 6 messaging.module \messaging_load_user()
- 6.2 messaging.module \messaging_load_user()
- 6.3 messaging.module \messaging_load_user()
Helper user loading function with static caching
4 calls to messaging_load_user()
- Messaging_Message::get_sender in includes/
messaging_message.class.inc - Get sender account
- messaging_simple_format_address in messaging_simple/
messaging_simple.module - Callback for address formatting
- messaging_user_object in ./
messaging.module - Helper function, get object from account parameter (object or uid)
- Messaging_User_Object::get_user in includes/
messaging_object.class.inc - Get destination user
File
- ./
messaging.module, line 572
Code
function messaging_load_user($uid) {
$cache =& messaging_static(__FUNCTION__);
if (!$cache || !array_key_exists($uid, $cache)) {
if ($uid) {
$cache[$uid] = user_load($uid);
}
else {
$cache[0] = drupal_anonymous_user();
// This will prevent some notice from token module
$cache[0]->name = variable_get('anonymous', 'Anonymous');
}
}
return $cache[$uid];
}