aboutsummaryrefslogtreecommitdiff
path: root/actions/admin/user/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'actions/admin/user/delete.php')
-rw-r--r--actions/admin/user/delete.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/actions/admin/user/delete.php b/actions/admin/user/delete.php
index e8d835722..a5e1886ec 100644
--- a/actions/admin/user/delete.php
+++ b/actions/admin/user/delete.php
@@ -15,13 +15,18 @@ admin_gatekeeper();
// Get the user
$guid = get_input('guid');
-$obj = get_entity($guid);
+$user = get_entity($guid);
-$name = $obj->name;
-$username = $obj->username;
+if ($guid == get_loggedin_userid()) {
+ register_error(elgg_echo('admin:user:self:delete:no'));
+ forward(REFERER);
+}
+
+$name = $user->name;
+$username = $user->username;
-if (($obj instanceof ElggUser) && ($obj->canEdit())) {
- if ($obj->delete()) {
+if (($user instanceof ElggUser) && ($user->canEdit())) {
+ if ($user->delete()) {
system_message(elgg_echo('admin:user:delete:yes', array($name)));
} else {
register_error(elgg_echo('admin:user:delete:no'));