You are here

function simplenews_subscription_multiple_delete_confirm in Simplenews 6.2

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_subscription_multiple_delete_confirm()
  2. 6 simplenews.admin.inc \simplenews_subscription_multiple_delete_confirm()

Menu callback: Delete multiple subscriptions.

See also

simplenews_subscription_multiple_delete_confirm_submit()

1 string reference to 'simplenews_subscription_multiple_delete_confirm'
simplenews_menu in ./simplenews.module
Implementation of hook_menu().

File

includes/simplenews.admin.inc, line 415
Newsletter admin, subscription admin, simplenews settings

Code

function simplenews_subscription_multiple_delete_confirm() {

  // Subscriptions to be deleted are passed via session var.
  $snids = $_SESSION['simplenews_subscriptions_delete'];
  $form['snids'] = array(
    '#prefix' => '<ul>',
    '#suffix' => '</ul>',
    '#tree' => TRUE,
  );

  // array_filter returns only elements with TRUE values
  foreach (array_filter($snids) as $snid => $value) {
    $mail = db_result(db_query('
      SELECT mail
      FROM {simplenews_subscriptions}
      WHERE snid = %d', $snid));
    $form['snids'][$snid] = array(
      '#type' => 'hidden',
      '#value' => $snid,
      '#prefix' => '<li>',
      '#suffix' => check_plain($mail) . "</li>\n",
    );
  }
  $form['operation'] = array(
    '#type' => 'hidden',
    '#value' => 'delete',
  );
  $form['#submit'][] = 'simplenews_subscription_multiple_delete_confirm_submit';
  return confirm_form($form, t('Are you sure you want to delete these subscriptions?'), 'admin/content/simplenews/users', t('This action cannot be undone.'), t('Delete all'), t('Cancel'));
}