You are here

function notifications_subscriptions_operations in Notifications 6

Same name and namespace in other branches
  1. 6.4 notifications.manage.inc \notifications_subscriptions_operations()
  2. 6.2 notifications.manage.inc \notifications_subscriptions_operations()
  3. 6.3 notifications.manage.inc \notifications_subscriptions_operations()

Subscription mass operations.

Parameters

$account: User account if we are administering subscriptions for this user

2 calls to notifications_subscriptions_operations()
notifications_manage_subscriptions_form in ./notifications.manage.inc
Administer user subscriptions
notifications_manage_subscriptions_form_submit in ./notifications.manage.inc
Handle manage form submissions, run batch operations

File

./notifications.manage.inc, line 247
Common functions for bulk management of subscriptions

Code

function notifications_subscriptions_operations($account = NULL) {
  $operations = array(
    'block' => array(
      'label' => t('Block'),
      'callback' => 'notifications_subscriptions_mass_update',
      'callback arguments' => array(
        'updates' => array(
          'status' => NOTIFICATIONS_SUBSCRIPTION_BLOCKED,
        ),
      ),
    ),
    'activate' => array(
      'label' => t('Activate'),
      'callback' => 'notifications_subscriptions_mass_update',
      'callback arguments' => array(
        'updates' => array(
          'status' => NOTIFICATIONS_SUBSCRIPTION_ACTIVE,
        ),
      ),
    ),
    'deactivate' => array(
      'label' => t('Deactivate'),
      'callback' => 'notifications_subscriptions_mass_update',
      'callback arguments' => array(
        'updates' => array(
          'status' => NOTIFICATIONS_SUBSCRIPTION_INACTIVE,
        ),
      ),
    ),
    'delete' => array(
      'label' => t('Delete'),
      'callback' => NULL,
    ),
  );

  // Sending methods
  $parent = t('Change send method to');
  foreach (messaging_method_list($account) as $key => $name) {
    $operations['send_method-' . $key] = array(
      'label' => $name,
      'parent' => $parent,
      'callback' => 'notifications_subscriptions_mass_update',
      'callback arguments' => array(
        'updates' => array(
          'send_method' => $key,
        ),
      ),
    );
  }
  $parent = t('Change send interval to');
  foreach (_notifications_send_intervals() as $key => $name) {
    $operations['send_method-' . $key] = array(
      'label' => $name,
      'parent' => $parent,
      'callback' => 'notifications_subscriptions_mass_update',
      'callback arguments' => array(
        'updates' => array(
          'send_interval' => $key,
        ),
      ),
    );
  }

  // Intervals
  return $operations;
}