1 user.module user_action_info()

Implements hook_action_info().

File

core/modules/user/user.module, line 3065
Enables the user registration and login system.

Code

function user_action_info() {
  $actions['user_block_user_action'] = array(
    'label' => t('Block user(s)'),
    'type' => 'user',
    'callback' => 'user_block_user_action',
    'file' => 'user.actions.inc',
    'weight' => -2,
  );
  $actions['user_unblock_user_action'] = array(
    'label' => t('Unblock user(s)'),
    'type' => 'user',
    'callback' => 'user_unblock_user_action',
    'file' => 'user.actions.inc',
    'weight' => -1,
  );
  $actions['user_cancel_user_action'] = array(
    'label' => t('Cancel user account(s)'),
    'type' => 'user',
    'callback' => 'user_cancel_user_action',
    'file' => 'user.actions.inc',
    'weight' => 10,
  );

  $roles = user_roles(TRUE, NULL, TRUE);
  $index = 0;
  foreach ($roles as $role_name => $role) {
    if ($role_name === BACKDROP_AUTHENTICATED_ROLE) {
      continue;
    }
    if (!user_access('assign roles') && !user_access('administer permissions')) {
      continue;
    }
    $index++;

    $actions['user_add_role_' . $role_name] = array(
      'label' => t('Add role "@label"', array('@label' => $role->label)),
      'type' => 'user',
      'callback' => 'user_add_role_action',
      'file' => 'user.actions.inc',
      'weight' => 120 + $index,
      'role_name' => $role_name,
    );
    $actions['user_remove_role_' . $role_name] = array(
      'label' => t('Remove role "@label"', array('@label' => $role->label)),
      'type' => 'user',
      'callback' => 'user_remove_role_action',
      'file' => 'user.actions.inc',
      'weight' => 150 + $index,
      'role_name' => $role_name,
    );
  }

  return $actions;
}