function UserUnblock::doExecute
Unblock a user.
Parameters
\Drupal\user\UserInterface $user: The user to unblock.
File
-
src/
Plugin/ RulesAction/ UserUnblock.php, line 39
Class
- UserUnblock
- Provides "Unblock User" action.
Namespace
Drupal\rules\Plugin\RulesActionCode
protected function doExecute(UserInterface $user) {
// Do nothing if user is anonymous or isn't blocked.
if ($user->isAuthenticated() && $user->isBlocked()) {
$user->activate();
// Set flag that indicates if the entity should be auto-saved later.
$this->saveLater = TRUE;
}
}