aboutsummaryrefslogtreecommitdiff
path: root/actions/useradd.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/useradd.php')
-rw-r--r--actions/useradd.php34
1 files changed, 19 insertions, 15 deletions
diff --git a/actions/useradd.php b/actions/useradd.php
index cdd9adcf7..f7a96b037 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -27,23 +27,27 @@
if (is_array($admin)) $admin = $admin[0];
// For now, just try and register the user
- if (
- (
- (trim($password)!="") &&
- (strcmp($password, $password2)==0)
- ) &&
- ($guid = register_user($username, $password, $name, $email))
- ) {
- if (($guid) && ($admin))
- {
+ try {
+ if (
+ (
+ (trim($password)!="") &&
+ (strcmp($password, $password2)==0)
+ ) &&
+ ($guid = register_user($username, $password, $name, $email, true))
+ ) {
+ if (($guid) && ($admin))
+ {
+
+ $new_user = get_entity($guid);
+ $new_user->admin = 'yes';
+ }
- $new_user = get_entity($guid);
- $new_user->admin = 'yes';
+ system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
+ } else {
+ register_error(elgg_echo("adduser:bad"));
}
-
- system_message(sprintf(elgg_echo("adduser:ok"),$CONFIG->sitename));
- } else {
- register_error(elgg_echo("adduser:bad"));
+ } catch (RegistrationException $r) {
+ register_error($r->getMessage());
}
forward($_SERVER['HTTP_REFERER']);