You are here

function user_user_operations_block in Drupal 7

Same name and namespace in other branches
  1. 5 modules/user/user.module \user_user_operations_block()
  2. 6 modules/user/user.module \user_user_operations_block()

Callback function for admin mass blocking users.

2 string references to 'user_user_operations_block'
hook_user_operations in modules/user/user.api.php
Add mass user operations.
user_user_operations in modules/user/user.module
Implements hook_user_operations().

File

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

Code

function user_user_operations_block($accounts) {
  $accounts = user_load_multiple($accounts);
  foreach ($accounts as $account) {

    // Skip blocking user if they are already blocked.
    if ($account !== FALSE && $account->status == 1) {

      // For efficiency manually save the original account before applying any
      // changes.
      $account->original = clone $account;
      user_save($account, array(
        'status' => 0,
      ));
    }
  }
}