You are here

function hook_privatemsg_autocomplete_alter in Privatemsg 6.2

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

Allows to alter the found autocompletions.

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

1 function implements 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
1 invocation of hook_privatemsg_autocomplete_alter()
privatemsg_autocomplete in ./privatemsg.pages.inc
Return autocomplete results for usernames.

File

./privatemsg.api.php, line 482
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]);
      }
    }
  }
}