aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-09-10 18:09:15 -0400
committerCash Costello <cash.costello@gmail.com>2011-09-10 18:09:15 -0400
commit9097dd60953aa7f590a8de57c1c8302bf16beaef (patch)
tree3cc90ffb236eb44ab541be12cc4e021743717581
parentdf80e299c015a9d6d661b4705f65cdbcaad5aaba (diff)
downloadelgg-9097dd60953aa7f590a8de57c1c8302bf16beaef.tar.gz
elgg-9097dd60953aa7f590a8de57c1c8302bf16beaef.tar.bz2
Fixes #3782 only deleting metadata if the entity has been saved
-rw-r--r--engine/classes/ElggEntity.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index 7c8828a98..2fa0d7b02 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -371,13 +371,18 @@ abstract class ElggEntity extends ElggData implements
* Deletes all metadata on this object (metadata.entity_guid = $this->guid).
* If you pass a name, only metadata matching that name will be deleted.
*
- * @warning Calling this with no or empty arguments will clear all metadata on the entity.
+ * @warning Calling this with no $name will clear all metadata on the entity.
*
- * @param null|string $name The metadata name to remove.
+ * @param null|string $name The name of the metadata to remove.
* @return bool
* @since 1.8
*/
public function deleteMetadata($name = null) {
+
+ if (!$this->guid) {
+ return false;
+ }
+
$options = array(
'guid' => $this->guid,
'limit' => 0