From a6820140aeb091ec3ec744454546a131d2554464 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 27 Apr 2009 11:40:38 +0000 Subject: 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 --- engine/lib/users.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'engine') 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; -- cgit v1.2.3