Restores a user
public static undoDelete ( string $email ) : boolean | ||
string | The e-mail address of the user to restore. | |
Результат | boolean |
/** * Execute the action */ public function execute() { $email = $this->getParameter('email', 'string'); // does the user exist if ($email !== null) { parent::execute(); // delete item if (BackendUsersModel::undoDelete($email)) { // get user $user = new BackendUser(null, $email); // trigger event $item = array('id' => $user->getUserId(), 'email' => $email); BackendModel::triggerEvent($this->getModule(), 'after_undelete', array('item' => $item)); // item was deleted, so redirect $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $user->getUserId() . '&report=restored&var=' . $user->getSetting('nickname') . '&highlight=row-' . $user->getUserId()); } else { // invalid user $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }