user_block_user_action

Versions
6 – 7
user_block_user_action(&$object, $context = array())

Implement a Drupal action. Blocks the current user.

Code

modules/user/user.module, line 3059

<?php
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_update('users')
    ->fields(array('status' => 0))
    ->condition('uid', $uid)
    ->execute();
  drupal_session_destroy_uid($uid);
  watchdog('action', 'Blocked user %name.', array('%name' => $user->name));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.