You are here

function hook_privatemsg_name_lookup in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.api.php \hook_privatemsg_name_lookup()
  2. 6 privatemsg.api.php \hook_privatemsg_name_lookup()
  3. 7.2 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

3 functions implement hook_privatemsg_name_lookup()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

privatemsg_privatemsg_name_lookup in ./privatemsg.module
Implements hook_privatemsg_name_lookup().
privatemsg_realname_privatemsg_name_lookup in privatemsg_realname/privatemsg_realname.module
Implements hook_privatemsg_name_lookup().
privatemsg_roles_privatemsg_name_lookup in privatemsg_roles/privatemsg_roles.module
Implements hook_privatemsg_name_lookup().
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 510
Privatemsg API Documentation

Code

function hook_privatemsg_name_lookup($string) {
  $result = db_query("SELECT *, rid AS recipient FROM {role} WHERE name = '%s'", trim($string));
  if ($role = db_fetch_object($result)) {
    $role->type = 'role';
    return $role;
  }
}