You are here

function privatemsg_user_autocomplete in Privatemsg 6.2

Same name and namespace in other branches
  1. 7.2 privatemsg.module \privatemsg_user_autocomplete()
  2. 7 privatemsg.module \privatemsg_user_autocomplete()

Implements callback_recipient_autocomplete().

1 string reference to 'privatemsg_user_autocomplete'
privatemsg_privatemsg_recipient_type_info in ./privatemsg.module
Implements hook_privatemsg_recipient_type_info().

File

./privatemsg.module, line 2828
Allows users to send private messages to other users.

Code

function privatemsg_user_autocomplete($fragment, $names, $limit) {
  $query = _privatemsg_assemble_query('autocomplete', $fragment, $names);
  $result = db_query_range($query['query'], $fragment, 0, $limit);
  $suggestions = array();
  while ($user = db_fetch_object($result)) {
    $account = privatemsg_user_load($user->uid);
    $account->type = 'user';
    $account->recipient = $account->uid;
    $suggestions[privatemsg_recipient_key($account)] = $account;
  }
  return $suggestions;
}