You are here

private function UserCredentials::setStatus in DRD Agent 8.3

Same name and namespace in other branches
  1. 4.0.x src/Agent/Action/UserCredentials.php \Drupal\drd_agent\Agent\Action\UserCredentials::setStatus()

Callback to set the status of the user account.

Parameters

\Drupal\user\Entity\User $account: User account which should be changed.

array $args: Array of arguments.

1 call to UserCredentials::setStatus()
UserCredentials::execute in src/Agent/Action/UserCredentials.php
Execute an action.

File

src/Agent/Action/UserCredentials.php, line 85

Class

UserCredentials
Provides a 'UserCredentials' code.

Namespace

Drupal\drd_agent\Agent\Action

Code

private function setStatus(User $account, array $args) {
  if (!isset($args['status'])) {
    return;
  }
  if ($args['status']) {
    $account
      ->activate();
  }
  else {
    $account
      ->block();
  }
}