function privatemsg_roles_load_recipients in Privatemsg 6.2
Same name and namespace in other branches
- 7.2 privatemsg_roles/privatemsg_roles.module \privatemsg_roles_load_recipients()
- 7 privatemsg_roles/privatemsg_roles.module \privatemsg_roles_load_recipients()
Loads users with a specific role.
2 string references to 'privatemsg_roles_load_recipients'
- hook_privatemsg_recipient_type_info in ./
privatemsg.api.php - This hook is used to tell privatemsg about the recipient types defined by a module. Each type consists of an array keyed by the internal recipient type name and the following keys must be defined.
- privatemsg_roles_privatemsg_recipient_type_info in privatemsg_roles/
privatemsg_roles.module - Implements hook_privatemsg_recipient_type_info().
File
- privatemsg_roles/
privatemsg_roles.module, line 104 - Allows to send messages to all members of a role.
Code
function privatemsg_roles_load_recipients($recipient, $limit, $offset) {
$recipients = array();
$rid = isset($recipient->recipient) ? $recipient->recipient : $recipient->rid;
if ($rid == DRUPAL_AUTHENTICATED_RID) {
$result = db_query_range('SELECT uid FROM {users} WHERE uid > 0 ORDER BY uid ASC', $offset, $limit);
}
else {
$result = db_query_range('SELECT uid FROM {users_roles} WHERE rid = %d ORDER BY uid ASC', $rid, $offset, $limit);
}
while ($row = db_fetch_object($result)) {
$recipients[] = $row->uid;
}
return $recipients;
}