Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UnblockUser.php

function UnblockUser::execute

Overrides ExecutableInterface::execute

File

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

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();
    }
}
RSS feed
Powered by Drupal