aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-27 11:40:38 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-27 11:40:38 +0000
commita6820140aeb091ec3ec744454546a131d2554464 (patch)
tree9baa0295b7ae43f8dcc003c7017248d448db90bf
parent686eb26daae1f3602cdf83659feb4fa995f4f80e (diff)
downloadelgg-a6820140aeb091ec3ec744454546a131d2554464.tar.gz
elgg-a6820140aeb091ec3ec744454546a131d2554464.tar.bz2
Closes #943: Event triggered when banning or unbanning a user.
git-svn-id: https://code.elgg.org/elgg/trunk@3238 36083f99-b078-4883-b0ff-0f9b5a30f544
-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;