diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-29 17:09:01 -0700 |
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-29 17:09:01 -0700 |
| commit | 04bf50bfb4241f7c814782c516732d927ff1f457 (patch) | |
| tree | 0877e4010b7242cf5eba51cb6fddd1c99630472d /modules/user/controllers/admin_users.php | |
| parent | 392e24e56b4afa0e8752fd740f613f5556955342 (diff) | |
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.
Diffstat (limited to 'modules/user/controllers/admin_users.php')
| -rw-r--r-- | modules/user/controllers/admin_users.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/user/controllers/admin_users.php b/modules/user/controllers/admin_users.php index 269e3dc8..a7db6179 100644 --- a/modules/user/controllers/admin_users.php +++ b/modules/user/controllers/admin_users.php @@ -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; } |
