function advuser_multiple_email_confirm_submit in Advanced User 6.2
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.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm_submit()
- 7.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm_submit()
File
- ./
advuser.module, line 417 - 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_multiple_email_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) {
foreach ($form_state['values']['accounts'] as $uid => $value) {
$account = user_load(array(
'uid' => $uid,
));
$from = variable_get("site_mail", "nobody@{$_SERVER['SERVER_NAME']}");
// these are invariant for all sent emails
$variables = _advuser_get_variables($account);
$mail_subject = strtr($form_state['values']['mailsubject'], $variables);
$mail_body = strtr($form_state['values']['mailbody'], $variables);
drupal_mail('advuser', 'advance-user-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';
}