diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-04-22 15:20:13 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-04-22 15:20:13 +0000 |
commit | 8b5fd806d6871aaeb179376328a8af215ed44f88 (patch) | |
tree | a31f8cc50864e11f850e610eaa2877e8f4419e45 /engine/lib/metadata.php | |
parent | d99f1028ce873ab99c345dcea5b4fba67d73203d (diff) | |
download | elgg-8b5fd806d6871aaeb179376328a8af215ed44f88.tar.gz elgg-8b5fd806d6871aaeb179376328a8af215ed44f88.tar.bz2 |
Closes #957: Annotations and metadata owned by a deleted user are now also deleted.
git-svn-id: https://code.elgg.org/elgg/trunk@3227 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r-- | engine/lib/metadata.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 3decc1461..57987107c 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -730,6 +730,27 @@ return delete_data("DELETE from {$CONFIG->dbprefix}metadata where entity_guid={$entity_guid}");
}
return false;
+ } + + /** + * Clear all annotations belonging to a given owner_guid + * + * @param int $owner_guid The owner + */ + function clear_metadata_by_owner($owner_guid) + { + $owner_guid = (int)$owner_guid; + + $metas = get_data("SELECT id from {$CONFIG->dbprefix}metadata WHERE owner_guid=$owner_guid"); + $deleted = 0; + + foreach ($metas as $id) + { + if (delete_metadata($id)) // Is this the best way? + $deleted++; + } + + return $deleted; }
/**
|