function advuser_multiple_email_confirm_submit in Advanced User 6.3
Same name and namespace in other branches
- 5.2 advuser.module \advuser_multiple_email_confirm_submit()
- 5 advuser.module \advuser_multiple_email_confirm_submit()
- 6.2 advuser.module \advuser_multiple_email_confirm_submit()
- 7.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm_submit()
The submit handler for the Email button.
File
- forms/
advuser_multiple_email_confirm.inc, line 113
Code
function advuser_multiple_email_confirm_submit($form, &$form_state) {
$advuser =& $_SESSION['advuser'];
$accounts =& $advuser['accounts'];
if ($form_state['values']['confirm']) {
foreach ($accounts as $uid => $value) {
$account = user_load(array(
'uid' => $uid,
));
$from = $form_state['values']['mailfrom'];
$types = array(
'user' => $account,
);
$mail_subject = token_replace_multiple($form_state['values']['mailsubject'], $types, ADVUSER_TOKEN_PREFIX, ADVUSER_TOKEN_SUFFIX);
$mail_body = token_replace_multiple($form_state['values']['mailbody'], $types, ADVUSER_TOKEN_PREFIX, ADVUSER_TOKEN_SUFFIX);
drupal_mail('advuser', 'advuser-mail', $account->mail, user_preferred_language($account), array(
'subject' => $mail_subject,
'body' => $mail_body,
), $from, TRUE);
}
drupal_set_message(t('The users have been mailed.'));
}
$form_state['redirect'] = 'admin/user/user/advuser';
advuser_reset_variables();
}