aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-13 12:14:40 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-13 12:14:40 +0000
commit0b2a1d2d617456dab58cb9928d0f61dac56fcaba (patch)
treecd2e710784bc2a07ca78fee7795392329023289b /engine/lib/entities.php
parenta3b07f0ffe9dfdcd39290dee4386f23e7be80b94 (diff)
downloadelgg-0b2a1d2d617456dab58cb9928d0f61dac56fcaba.tar.gz
elgg-0b2a1d2d617456dab58cb9928d0f61dac56fcaba.tar.bz2
Added a reason for disabled objects.
git-svn-id: https://code.elgg.org/elgg/trunk@1891 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index fe43832ff..29c347690 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -657,10 +657,12 @@
/**
* Disable this entity.
+ *
+ * @param string $reason Optional reason
*/
- public function disable()
+ public function disable($reason = "")
{
- return disable_entity($this->get('guid'));
+ return disable_entity($this->get('guid'), $reason);
}
/**
@@ -1454,17 +1456,23 @@
/**
* Disable an entity but not delete it.
*
- * @param int $guid
+ * @param int $guid The guid
+ * @param string $reason Optional reason
*/
- function disable_entity($guid)
+ function disable_entity($guid, $reason = "")
{
global $CONFIG;
$guid = (int)$guid;
+ $reason = sanitise_string($reason);
+
if ($entity = get_entity($guid)) {
if (trigger_elgg_event('delete',$entity->type,$entity)) {
if ($entity->canEdit()) {
+ if ($reason)
+ $entity->disable_reason = $reason;
+
$res = update_data("UPDATE {$CONFIG->dbprefix}entities set enabled='no' where guid={$guid}");
return $res;