function hook_privatemsg_sql_autocomplete_alter in Privatemsg 6.2
Same name and namespace in other branches
- 6 privatemsg.api.php \hook_privatemsg_sql_autocomplete_alter()
Query to search for autocomplete usernames.
Parameters
$fragments: Query fragments
$search: Search for that username
$names: Names that are already in the list and are excluded
Related topics
3 functions implement hook_privatemsg_sql_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_sql_autocomplete_alter in pm_block_user/
pm_block_user.module - Implememts hook_privatemsg_sql_autocomplete_alter().
- privatemsg_filter_privatemsg_sql_autocomplete_alter in privatemsg_filter/
privatemsg_filter.module - Limit the user autocomplete for the filter widget.
- privatemsg_realname_privatemsg_sql_autocomplete_alter in privatemsg_realname/
privatemsg_realname.module - Implements hook_privatemsg_sql_autocomplete_alter().
File
- ./
privatemsg.api.php, line 124 - Privatemsg API Documentation
Code
function hook_privatemsg_sql_autocomplete_alter(&$fragments, $search, $names) {
global $user;
// Extend the query that searches for usernames
// $fragments is explained in the api documentation in detail
// The query is already set up, it's searching for usernames which start with
// $search and are not $names (may be empty)
// the main table is {user} a
// 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.
$fragments['inner_join'] = 'INNER JOIN {my_table} m ON (m.user1 = u.uid AND m.user2 = %d)';
$fragments['query_args'][] = $user->uid;
}