function privatemsg_rules_thread_has_tag in Privatemsg 6.2
Same name and namespace in other branches
- 7.2 privatemsg_rules/privatemsg_rules.rules.inc \privatemsg_rules_thread_has_tag()
- 7 privatemsg_rules/privatemsg_rules.rules.inc \privatemsg_rules_thread_has_tag()
Check if a thread has a specific tag.
Parameters
$thread_id: Which thread to check.
$account: Which user should be checked.
$tag_settings: Rules settings, includes the tag that should be checked.
Return value
TRUE if the thread has such a tag, FALSe otherwise.
File
- privatemsg_rules/
privatemsg_rules.rules.inc, line 462 - Hooks and callback functions for rules.module integration.
Code
function privatemsg_rules_thread_has_tag($thread_id, $account, $tag_settings) {
$tag = privatemsg_rules_load_tag($tag_settings);
$tag = $tag['tag_loaded'];
if (empty($tag)) {
rules_log(t('No tag to compare found'), TRUE);
return FALSE;
}
$query = _privatemsg_assemble_query(array(
'tags',
'privatemsg_filter',
), $account, array(
$thread_id,
));
$result = db_query($query['query']);
while ($row = db_fetch_object($result)) {
if ($row->tag_id == $tag->tag_id) {
return TRUE;
}
}
return FALSE;
}