From: Cash Costello Date: Sat, 10 Sep 2011 22:09:15 +0000 (-0400) Subject: Fixes #3782 only deleting metadata if the entity has been saved X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=9097dd60953aa7f590a8de57c1c8302bf16beaef;p=lorea%2Felgg.git Fixes #3782 only deleting metadata if the entity has been saved --- 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