You are here

public function UnblockUser::execute in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/user/src/Plugin/Action/UnblockUser.php \Drupal\user\Plugin\Action\UnblockUser::execute()

Executes the plugin.

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();
  }
}