function advuser_multiple_email_confirm in Advanced User 6.3
Same name and namespace in other branches
- 5.2 advuser.module \advuser_multiple_email_confirm()
- 5 advuser.module \advuser_multiple_email_confirm()
- 6.2 advuser.module \advuser_multiple_email_confirm()
- 7.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm()
The menu callback function for admin/user/user/advuser/confirm/email
1 string reference to 'advuser_multiple_email_confirm'
- advuser_menu in ./
advuser.module - Implementation of hook_menu().
File
- forms/
advuser_multiple_email_confirm.inc, line 15
Code
function advuser_multiple_email_confirm(&$form_state) {
global $user;
$advuser =& $_SESSION['advuser'];
$accounts =& $advuser['accounts'];
$selectall =& $advuser['selectall'];
$deselected =& $advuser['deselected'];
$form['accounts'] = array(
'#prefix' => '<ul>',
'#suffix' => '</ul>',
'#tree' => TRUE,
);
// array_filter returns only elements with TRUE values
$form['accounts'] = array(
'#type' => 'fieldset',
'#title' => t('Selected accounts'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
if ($selectall) {
$sql = advuser_build_query('name');
$filter = advuser_build_filter_query();
$result = db_query($sql, $filter['args']);
while ($account = db_fetch_object($result)) {
if (!isset($deselected[$account->uid])) {
$accounts[$account->uid] = $account->uid;
$form['accounts'][$account->uid] = array(
'#type' => 'markup',
'#value' => check_plain($account->name),
'#prefix' => '<li>',
'#suffix' => '</li>',
);
}
}
}
else {
foreach (array_filter($accounts) as $uid => $value) {
$username = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $uid));
$form['accounts'][$uid] = array(
'#type' => 'markup',
'#value' => check_plain($username),
'#prefix' => '<li>',
'#suffix' => "</li>",
);
}
}
$form['operation'] = array(
'#type' => 'hidden',
'#value' => 'email',
);
$form['variables'] = array(
'#type' => 'markup',
'#prefix' => '<div class="advuser-inset-panel">',
'#value' => t(ADVUSER_SUBSTITUTION_TEXT, array(
'!tokens' => _advuser_get_tokens_list(),
)),
'#suffix' => '</div>',
);
$from = variable_get("site_mail", "nobody@{$_SERVER['SERVER_NAME']}");
if (variable_get('advuser_senders_from_address', FALSE)) {
$from = $user->mail;
}
if (variable_get('advuser_nobody_from_address', FALSE)) {
$from = "nobody@{$_SERVER['SERVER_NAME']}";
}
$form['mailfrom'] = array(
'#type' => 'textfield',
'#title' => t('From'),
'#value' => $from,
'#default_value' => $from,
'#disabled' => TRUE,
);
$form['mailsubject'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#required' => TRUE,
);
$form['mailbody'] = array(
'#type' => 'textarea',
'#title' => t('Mail body'),
'#required' => TRUE,
);
return confirm_form($form, t('Are you sure you want to email these users?'), 'admin/user/user/advuser', t('This action cannot be undone.'), t('Email'), t('Cancel'));
}