You are here

function advuser_multiple_email_confirm_submit in Advanced User 5

Same name and namespace in other branches
  1. 5.2 advuser.module \advuser_multiple_email_confirm_submit()
  2. 6.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm_submit()
  3. 6.2 advuser.module \advuser_multiple_email_confirm_submit()
  4. 7.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm_submit()

File

./advuser.module, line 352

Code

function advuser_multiple_email_confirm_submit($form_id, $edit) {
  if ($edit['confirm']) {
    foreach ($edit['users'] as $uid => $value) {
      $account = user_load(array(
        'uid' => $uid,
      ));
      if (module_exists('lightcrm')) {
        _lightcrm_comment_add($uid, $edit['mailsubject'], $edit['mailbody']);
      }
      else {
        $from = variable_get("site_mail", ini_get("sendmail_from"));

        // http://drupal.org/node/77689
        drupal_mail('advance-user-mail', $account->mail, $edit['mailsubject'], $edit['mailbody'], $from);
      }
    }
    drupal_set_message(t('The users have been mailed.'));
  }
  drupal_goto('admin/user/advuser');
}