/** * Unblock a user. * * @param \Drupal\user\UserInterface $user * The user to unblock. */ 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; } }
/** * {@inheritdoc} */ public function isBlocked() { return $this->subject->isBlocked(); }
/** * Check if user is blocked. * * @param \Drupal\user\UserInterface $account * The account to check. * * @return bool * TRUE if the account is blocked. */ protected function doEvaluate(UserInterface $account) { return $account->isBlocked(); }