diff options
-rw-r--r-- | actions/email/save.php | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/actions/email/save.php b/actions/email/save.php index 236e011cb..4c2301c92 100644 --- a/actions/email/save.php +++ b/actions/email/save.php @@ -25,17 +25,23 @@ $user = get_entity($user_id); if ($user) - {
- if ($user->email != $email) { - $user->email = $email; - if ($user->save()) - { - request_user_validation($user->getGUID()); - system_message(elgg_echo('email:save:success')); + { + if (!get_user_by_email($email)) + { +
+ if ($user->email != $email) { + $user->email = $email; + if ($user->save()) + { + request_user_validation($user->getGUID()); + system_message(elgg_echo('email:save:success')); + } + else + register_error(elgg_echo('email:save:fail'));
} - else - register_error(elgg_echo('email:save:fail'));
} + else + register_error(elgg_echo('registration:dupeemail')); } else register_error(elgg_echo('email:save:fail')); |