You are here

function advuser_multiple_email_confirm in Advanced User 6.2

Same name and namespace in other branches
  1. 5.2 advuser.module \advuser_multiple_email_confirm()
  2. 5 advuser.module \advuser_multiple_email_confirm()
  3. 6.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm()
  4. 7.3 forms/advuser_multiple_email_confirm.inc \advuser_multiple_email_confirm()
1 string reference to 'advuser_multiple_email_confirm'
advuser_admin in ./advuser.module

File

./advuser.module, line 369
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() {
  $edit = $_POST;
  $form['accounts'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  foreach (array_filter($edit['accounts']) as $uid => $value) {
    $user = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $uid));
    $form['accounts'][$uid] = array(
      '#type' => 'hidden',
      '#value' => $uid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($user) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'email',
  );
  $form['variables'] = array(
    '#type' => 'markup',
    '#prefix' => '<div class="advuser-inset-panel">',
    '#value' => t(ADVUSER_SUBSTITUTION_TEXT),
    '#suffix' => '</div>',
  );
  $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'));
}