By mcdruid on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
7.x
Introduced in version:
7.93
Issue links:
Description:
Drupal 7 now has a new user action "unblock current user" (user_unblock_user_action()) which allows to unblock a specific user or the current user through an action (configured via ex. Trigger module or the contributed Rules module).
The "unblock current user" actions uses the same logic as the existing "block current user" action in terms of user account selection (first priority is the user ID associated with the $entity object, second priority is the user ID associated with the $context data and the last priority is the current user). See:
// First priority: If there is a $entity->uid, unblock 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 unblock the current user.
else {
$uid = $GLOBALS['user']->uid;
}
The new action has a protection in place to disallow unblocking of an anonymous user. Such attempt will trigger a watchdog warning.
Impacts:
Site builders, administrators, editors
Module developers