function privatemsg_filter_sql_tags_autocomplete in Privatemsg 7
Same name and namespace in other branches
- 6.2 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_sql_tags_autocomplete()
- 6 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_sql_tags_autocomplete()
- 7.2 privatemsg_filter/privatemsg_filter.module \privatemsg_filter_sql_tags_autocomplete()
Query definition to get autocomplete suggestions for tags
Parameters
$search: String fragment to use for tag suggestions.
$tags: Array of tags not to be used as suggestions.
File
- privatemsg_filter/
privatemsg_filter.module, line 948 - Allows users to tag private messages and to filter based upon those tags.
Code
function privatemsg_filter_sql_tags_autocomplete($search, $tags) {
$query = db_select('pm_tags', 'pmt')
->fields('pmt', array(
'tag',
))
->condition('pmt.tag', $search . '%%', 'LIKE')
->orderBy('pmt.tag', 'ASC')
->range(0, 10);
if (!empty($tags)) {
$query
->condition('pmt.tag', $tags, 'NOT IN');
}
return $query;
}