function user_block_user_action

7.x user.module user_block_user_action(&$entity, $context = array())
6.x user.module user_block_user_action(&$object, $context = array())

Implementation of a Drupal action. Blocks the current user.

1 string reference to 'user_block_user_action'
user_action_info in drupal-6.x/modules/user/user.module
Implementation of hook_action_info().

File

drupal-6.x/modules/user/user.module, line 2320
Enables the user registration and login system.

Code

function user_block_user_action(&$object, $context = array()) {
  if (isset($object->uid)) {
    $uid = $object->uid;
  }
  elseif (isset($context['uid'])) {
    $uid = $context['uid'];
  }
  else {
    global $user;
    $uid = $user->uid;
  }
  db_query("UPDATE {users} SET status = 0 WHERE uid = %d", $uid);
  sess_destroy_uid($uid);
  watchdog('action', 'Blocked user %name.', array('%name' => check_plain($user->name)));
}