You are here

function privatemsg_roles_privatemsg_name_lookup in Privatemsg 6.2

Same name and namespace in other branches
  1. 7.2 privatemsg_roles/privatemsg_roles.module \privatemsg_roles_privatemsg_name_lookup()
  2. 7 privatemsg_roles/privatemsg_roles.module \privatemsg_roles_privatemsg_name_lookup()

Implements hook_privatemsg_name_lookup().

File

privatemsg_roles/privatemsg_roles.module, line 154
Allows to send messages to all members of a role.

Code

function privatemsg_roles_privatemsg_name_lookup($string) {

  // Remove optonal role specifier.
  $string = trim(str_replace(t('[role]'), '', $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 array(
      privatemsg_recipient_key($role) => $role,
    );
  }
}