You are here

function notifications_custom_delete_confirm in Notifications 6.4

Same name and namespace in other branches
  1. 6 notifications_custom/notifications_custom.admin.inc \notifications_custom_delete_confirm()

Menu callback; delete a single subscription type.

1 string reference to 'notifications_custom_delete_confirm'
notifications_custom_menu in notifications_custom/notifications_custom.module
Implementation of hook_menu().

File

notifications_custom/notifications_custom.admin.inc, line 285
Custom notifications module (admin features)

Code

function notifications_custom_delete_confirm(&$form_state, $custom) {
  $form['type'] = array(
    '#type' => 'value',
    '#value' => $custom->type,
  );
  $form['name'] = array(
    '#type' => 'value',
    '#value' => $custom->name,
  );
  $message = t('Are you sure you want to delete the subscription type %type?', array(
    '%type' => $custom->name,
  ));
  $caption = '';
  $num_nodes = db_result(db_query("SELECT COUNT(*) FROM {notifications} WHERE type = '%s'", $custom->type));
  if ($num_nodes) {
    $caption .= '<p>' . format_plural($num_nodes, '<strong>Warning:</strong> there is currently 1 %type subscription on your site. It may not be able to be displayed or edited correctly, once you have removed this content type.', '<strong>Warning:</strong> there are currently @count %type subscriptions on your site. They may not be able to be displayed or edited correctly, once you have removed this subscription type.', array(
      '%type' => $custom->name,
    )) . '</p>';
    $form['subscriptions'] = array(
      '#type' => 'checkbox',
      '#title' => t('Delete subscriptions'),
      '#description' => t('Marking this checkbox will delete also all subscription instances of this type for users of this site.'),
    );
  }
  $caption .= '<p>' . t('This action cannot be undone.') . '</p>';
  return confirm_form($form, $message, 'admin/messaging/customsubs', $caption, t('Delete'));
}