From a3b07f0ffe9dfdcd39290dee4386f23e7be80b94 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 13 Aug 2008 12:05:54 +0000 Subject: Closes #46: Method for activating an entity. No hookup yet. git-svn-id: https://code.elgg.org/elgg/trunk@1890 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'engine/lib/entities.php') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index afc8eed3c..fe43832ff 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -632,7 +632,7 @@ protected function load($guid) { $row = get_entity_as_row($guid); - + if ($row) { // Create the array if necessary - all subclasses should test before creating @@ -663,6 +663,14 @@ return disable_entity($this->get('guid')); } + /** + * Re-enable this entity. + */ + public function enable() + { + return enable_entity($this->get('guid')); + } + /** * Delete this entity. */ @@ -1466,6 +1474,20 @@ return false; } + /** + * Enable an entity again. + * + * @param int $guid + */ + function enable_entity($guid) + { + global $CONFIG; + + $guid = (int)$guid; + return update_data("UPDATE {$CONFIG->dbprefix}entities set enabled='yes' where guid={$guid}"); + + } + /** * Delete a given entity. * -- cgit v1.2.3