function hook_privatemsg_autocomplete_alter

7-1 privatemsg.api.php hook_privatemsg_autocomplete_alter(&$matches, $names, $fragment)
7-2 privatemsg.api.php hook_privatemsg_autocomplete_alter(&$matches, $names, $fragment)
6-2 privatemsg.api.php hook_privatemsg_autocomplete_alter(&$matches, $names, $fragment)

Allows to alter the found autocomplete suggestions.

Parameters

$matches: Array of matching recipient objects.

$names: Array of names that are already in the list.

$fragment: Fragment that is currently searched for.

Related topics

4 functions implement hook_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_privatemsg_autocomplete_alter in pm_block_user/pm_block_user.module
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().
1 invocation of hook_privatemsg_autocomplete_alter()
privatemsg_autocomplete in ./privatemsg.pages.inc
Return autocomplete results for usernames.

File

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

Code

function hook_privatemsg_autocomplete_alter(&$matches, $names, $fragment) {
  // Remove all types other than user if accessed through
  // messages/user/autocomplete.
  if (arg(1) == 'user') {
    foreach ($matches as $id => $match) {
      if ($match->type != 'user') {
        unset($matches[$id]);
      }
    }
  }
}