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

kmare’s picture

Status: Active » Needs review

well, 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! :)