You are here

function hook_query_privatemsg_autocomplete_alter in Privatemsg 7.2

Same name and namespace in other branches
  1. 7 privatemsg.api.php \hook_query_privatemsg_autocomplete_alter()

Query to search for autocomplete usernames.

Parameters

$query: Query object

See also

privatemsg_sql_autocomplete()

hook_query_alter()

Related topics

3 functions implement hook_query_privatemsg_autocomplete_alter()

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

pm_block_user_query_privatemsg_autocomplete_alter in pm_block_user/pm_block_user.module
Implements hook_query_TAG_alter().
privatemsg_filter_query_privatemsg_autocomplete_alter in privatemsg_filter/privatemsg_filter.module
Limit the user autocomplete for the filter widget.
privatemsg_realname_query_privatemsg_autocomplete_alter in privatemsg_realname/privatemsg_realname.module
Implements hook_query_privatemsg_autocomplete_alter().

File

./privatemsg.api.php, line 49
Privatemsg API Documentation

Code

function hook_query_privatemsg_autocomplete_alter($query) {
  global $user;
  $search = $query
    ->getMetaData('arg_1');
  $names = $query
    ->getMetaData('arg_2');

  // For example, add a join on a table where the user connections are stored
  // and specify that only users connected with the current user should be
  // loaded.
  $query
    ->innerJoin('my_table', 'm', 'm.user1 = u.uid AND m.user2 = :user2', array(
    ':user2' => $user->uid,
  ));
}