aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/users.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/users.php')
-rw-r--r--engine/lib/users.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 04e95c964..525e66127 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -464,13 +464,15 @@
$user = get_entity($user_guid);
if (($user) && ($user->canEdit()) && ($user instanceof ElggUser))
- {
- // Add reason
- if ($reason)
- create_metadata($user_guid, 'ban_reason', $reason,'', 0, ACCESS_PUBLIC);
-
- // Set ban flag
- return update_data("UPDATE {$CONFIG->dbprefix}users_entity set banned='yes' where guid=$user_guid");
+ {
+ if (trigger_elgg_event('ban', 'user', $user)) {
+ // Add reason
+ if ($reason)
+ create_metadata($user_guid, 'ban_reason', $reason,'', 0, ACCESS_PUBLIC);
+
+ // Set ban flag
+ return update_data("UPDATE {$CONFIG->dbprefix}users_entity set banned='yes' where guid=$user_guid");
+ }
}
return false;
@@ -490,9 +492,11 @@
$user = get_entity($user_guid);
if (($user) && ($user->canEdit()) && ($user instanceof ElggUser))
- {
- create_metadata($user_guid, 'ban_reason', '','', 0, ACCESS_PUBLIC);
- return update_data("UPDATE {$CONFIG->dbprefix}users_entity set banned='no' where guid=$user_guid");
+ {
+ if (trigger_elgg_event('unban', 'user', $user)) {
+ create_metadata($user_guid, 'ban_reason', '','', 0, ACCESS_PUBLIC);
+ return update_data("UPDATE {$CONFIG->dbprefix}users_entity set banned='no' where guid=$user_guid");
+ }
}
return false;