function user_block_user_action
Same name and namespace in other branches
- 6.x drupal-6.x/modules/user/user.module \user_block_user_action()
Blocks the current user.
Related topics
4 string references to 'user_block_user_action'
- drupal-6.bare.database.php in drupal-7.x/
modules/ simpletest/ tests/ upgrade/ drupal-6.bare.database.php - Bare installation of Drupal 6.17, for test purposes.
- drupal-6.filled.database.php in drupal-7.x/
modules/ simpletest/ tests/ upgrade/ drupal-6.filled.database.php - Filled installation of Drupal 6.17, for test purposes.
- TriggerUserActionTestCase::testUserActionAssignmentExecution in drupal-7.x/
modules/ trigger/ trigger.test - Tests user action assignment and execution.
- user_action_info in drupal-7.x/
modules/ user/ user.module - Implements hook_action_info().
Archivo
- drupal-7.x/
modules/ user/ user.module, line 3684 - Enables the user registration and login system.
Código
function user_block_user_action(&$entity, $context = array()) {
// First priority: If there is a $entity->uid, block that user.
// This is most likely a user object or the author if a node or comment.
if (isset($entity->uid)) {
$uid = $entity->uid;
}
elseif (isset($context['uid'])) {
$uid = $context['uid'];
}
// If neither of those are valid, then block the current user.
else {
$uid = $GLOBALS['user']->uid;
}
$account = user_load($uid);
$account = user_save($account, array('status' => 0));
watchdog('action', 'Blocked user %name.', array('%name' => $account->name));
}