function hook_privatemsg_name_lookup in Privatemsg 6
Same name and namespace in other branches
- 6.2 privatemsg.api.php \hook_privatemsg_name_lookup()
- 7.2 privatemsg.api.php \hook_privatemsg_name_lookup()
- 7 privatemsg.api.php \hook_privatemsg_name_lookup()
Hook which allows to look up a user object.
You can try to look up a user object based on the information passed to the hook. The first hook that successfully looks up a specific string wins.
Therefore, it is important to only return something if you can actually look up the string.
Related topics
1 invocation of hook_privatemsg_name_lookup()
- _privatemsg_parse_userstring in ./
privatemsg.module - Extract the valid usernames of a string and loads them.
File
- ./
privatemsg.api.php, line 476 - Privatemsg API Documentation
Code
function hook_privatemsg_name_lookup($string) {
if ((int) $string > 0) {
// This is a possible uid, try to load a matching user.
if ($recipient = user_load(array(
'uid' => $string,
))) {
return $recipient;
}
}
}