You are here

function simplenews_subscription_list_export in Simplenews 6.2

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_subscription_list_export()
  2. 6 simplenews.admin.inc \simplenews_subscription_list_export()
  3. 7.2 includes/simplenews.admin.inc \simplenews_subscription_list_export()
  4. 7 includes/simplenews.admin.inc \simplenews_subscription_list_export()

Menu callback: Export email address of subscriptions.

@todo Add checkboxes for subscribed and unsubscribed selection.

See also

simplenews_admin_export_after_build()

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

File

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

Code

function simplenews_subscription_list_export() {
  $form['states'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Status'),
    '#options' => array(
      'active' => t('Active users'),
      'inactive' => t('Inactive users'),
    ),
    '#description' => t('Subscriptions matching the selected states will be exported.'),
    '#required' => TRUE,
  );
  $newsletters = array();
  foreach (simplenews_get_newsletters(variable_get('simplenews_vid', ''), TRUE) as $newsletter) {
    $newsletters[$newsletter->tid] = check_plain($newsletter->name);
  }
  $form['newsletters'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Subscribed to'),
    '#options' => $newsletters,
    '#description' => t('Subscriptions matching the selected newsletters will be exported.'),
    '#required' => TRUE,
  );

  // Emails item is initially empty. It serves as place holder. Data is added by
  // simplenews_admin_export_after_build().
  $form['emails'] = array(
    '#type' => 'textarea',
    '#title' => t('Export results'),
    '#cols' => 60,
    '#rows' => 5,
    '#value' => '',
    '#access' => FALSE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Export'),
  );
  $form['#after_build'] = array(
    'simplenews_admin_export_after_build',
  );
  $form['#redirect'] = FALSE;
  return $form;
}