function _advuser_mail_roles in Advanced User 5.2
Same name and namespace in other branches
- 6.2 advuser.module \_advuser_mail_roles()
@private Mail users in requested notification role.
Parameters
string $user_subject:
string $user_body:
string $from:
2 calls to _advuser_mail_roles()
- advuser_user_insert in ./advuser.module 
- Handle user insertion (new users)
- advuser_user_update in ./advuser.module 
- Notify administrator of user profile edit.
File
- ./advuser.module, line 604 
- Advanced user module allows you to select users based on an advanced set of filtering and apply actions to block, unblock, delete or email the selected users.
Code
function _advuser_mail_roles($user_subject, $user_body, $from) {
  static $mail_list = array();
  if (empty($mail_list)) {
    $result = _advuser_dbquery_users_to_notify();
    while ($row = db_fetch_object($result)) {
      $mail_list[] = $row->mail;
    }
  }
  foreach ($mail_list as $to) {
    drupal_mail('advanced-user-mail', $to, $user_subject, $user_body, $from);
  }
}