diff options
-rw-r--r-- | actions/admin/user/ban.php | 5 | ||||
-rw-r--r-- | engine/lib/users.php | 21 |
2 files changed, 23 insertions, 3 deletions
diff --git a/actions/admin/user/ban.php b/actions/admin/user/ban.php index 33232b3eb..b13e9dfa0 100644 --- a/actions/admin/user/ban.php +++ b/actions/admin/user/ban.php @@ -21,10 +21,9 @@ $obj = get_entity($guid); if ( ($obj instanceof ElggUser) && ($obj->canEdit())) - {
- disable_user_entities($obj->guid); + { // Now actually disable it - if ($obj->disable('banned')) {
+ if ($obj->ban('banned')) {
system_message(elgg_echo('admin:user:ban:yes'));
} else diff --git a/engine/lib/users.php b/engine/lib/users.php index c3ad2abfd..9b8594a93 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -155,6 +155,27 @@ return parent::delete();
+ } + + /** + * Ban this user. + * + * @param string $reason Optional reason + */ + public function ban($reason = "") + { + if (disable_user_entities($this->guid)) + return $this->disable($reason); + + return false; + } + + /** + * Unban this user. + */ + public function unban() + { + return enable_entity($this->guid); }
/**
|