Needs review
Project:
Private Message Growl
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2012 at 22:09 UTC
Updated:
9 Feb 2012 at 16:44 UTC
When I send a message to all the users in a role, unfortunately no Growl notification is shown. I think the problem is in the pmgrowl_sql_unclosed() function. I made some changes to this function and now it works. I don't know if it's a problem to show messages of the type hidden :-)
function pmgrowl_sql_unclosed($account) {
// Set the primary table.
$query = db_select('pm_index', 'pmi')
->fields('pmi', array('mid'))
->condition('pmi.recipient', $account->uid)
// ->condition('pmi.type', array('user', 'type')) <-- removed
->condition('pmi.type', array('user', 'type', 'hidden')) // <-- added
->condition('pmi.is_new', 1)
->condition('pmi.deleted', 0)
->groupBy('pmi.mid')
->orderBy('pm.timestamp', 'ASC');
$query->join('pm_message', 'pm', 'pm.mid = pmi.mid');
// Select only messages that are not already closed.
$deleted = db_select('pmgrowl_close', 'pmg')
->fields('pmg', array('mid'))
->condition('pmg.uid', $account->uid)
->condition('pmg.closed', 1);
$query->condition('pmi.mid', $deleted, 'NOT IN');
return $query;
}
Comments
Comment #1
kmare commentedwell, I don't know as well if it's the proper solution adding the hidden parameter, but it looks like it's working for me. So thanks a lot, voskuh! :)