mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 11:29:24 -04:00
Use an event 'check_user_name_exists' to validate the input name is already in use. The parameter is a standard class with the name and an exists flag. Any event handler should or their result with the exists flag.
This commit is contained in:
@@ -36,7 +36,9 @@ class Admin_Users_Controller extends Admin_Controller {
|
||||
$form = $this->_get_user_add_form_admin();
|
||||
$valid = $form->validate();
|
||||
$name = $form->add_user->inputs["name"]->value;
|
||||
if ($user = user::lookup_by_name($name)) {
|
||||
$user_exists_data = (object)array("name" => $name);
|
||||
module::event("check_username_exists", $user_exists_data);
|
||||
if ($user_exists_data->exists) {
|
||||
$form->add_user->inputs["name"]->add_error("in_use", 1);
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user