/** * 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 activate() { return $this->subject->activate(); }