From 222cc0e52f45e31083bdcc3efe6916c62b9d4609 Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 1 Feb 2010 23:14:42 +0000 Subject: Added error checking to clear_metadata_by_owner(). git-svn-id: http://code.elgg.org/elgg/trunk@3897 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/metadata.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 17835e07e..e867311ae 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -977,10 +977,12 @@ function clear_metadata_by_owner($owner_guid) { $metas = get_data("SELECT id from {$CONFIG->dbprefix}metadata WHERE owner_guid=$owner_guid"); $deleted = 0; - foreach ($metas as $id) { - // Is this the best way? - if (delete_metadata($id->id)) { - $deleted++; + if (is_array($metas)) { + foreach ($metas as $id) { + // Is this the best way? + if (delete_metadata($id->id)) { + $deleted++; + } } } -- cgit v1.2.3