function UnblockUser::execute

Same name in other branches
  1. 9 core/modules/user/src/Plugin/Action/UnblockUser.php \Drupal\user\Plugin\Action\UnblockUser::execute()
  2. 10 core/modules/user/src/Plugin/Action/UnblockUser.php \Drupal\user\Plugin\Action\UnblockUser::execute()
  3. 11.x core/modules/user/src/Plugin/Action/UnblockUser.php \Drupal\user\Plugin\Action\UnblockUser::execute()

Overrides ExecutableInterface::execute

File

core/modules/user/src/Plugin/Action/UnblockUser.php, line 22

Class

UnblockUser
Unblocks a user.

Namespace

Drupal\user\Plugin\Action

Code

public function execute($account = NULL) {
    // Skip unblocking user if they are already unblocked.
    if ($account !== FALSE && $account->isBlocked()) {
        $account->activate();
        $account->save();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.