diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-18 18:33:34 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-18 18:33:34 +0000 |
commit | a33fdc7d15a9c8edd3fcff736a23857f4b1e0885 (patch) | |
tree | 707bb6f2b2a1f319d9dc78e6ac25f3c5b70843c4 /engine | |
parent | 9d4db97e2750a4fb0fecb839f5d1939433654c3f (diff) | |
download | elgg-a33fdc7d15a9c8edd3fcff736a23857f4b1e0885.tar.gz elgg-a33fdc7d15a9c8edd3fcff736a23857f4b1e0885.tar.bz2 |
Fixes #15: Ban user functionality
git-svn-id: https://code.elgg.org/elgg/trunk@981 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/entities.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index c53161e7f..96a622227 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -473,6 +473,14 @@ } /** + * Disable this entity. + */ + public function disable() + { + return disable_entity($this->get('guid')); + } + + /** * Delete this entity. */ public function delete() @@ -1096,6 +1104,29 @@ }
/** + * Disable an entity but not delete it. + * + * @param int $guid + */ + function disable_entity($guid) + { + global $CONFIG; + + $guid = (int)$guid; + if ($entity = get_entity($guid)) { + if (trigger_elgg_event('delete',$entity->type,$entity)) { + if ($entity->canEdit()) { + + $res = update_data("UPDATE {$CONFIG->dbprefix}entities set enabled='no' where guid={$guid}"); + + return $res; + } + } + } + return false; + } + + /** * Delete a given entity. * * @param int $guid |