You are here

function advuser_multiple_delete_confirm in Advanced User 6.2

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

File

./advuser.module, line 318
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_delete_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' => 'delete',
  );
  return confirm_form($form, t('Are you sure you want to delete these users?'), 'admin/user/user/advuser', t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
}