From 8b5fd806d6871aaeb179376328a8af215ed44f88 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 22 Apr 2009 15:20:13 +0000 Subject: 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 --- engine/lib/annotations.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engine/lib/annotations.php') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 8ad918180..dd647444a 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -820,6 +820,27 @@ } } + } + + /** + * Clear all annotations belonging to a given owner_guid + * + * @param int $owner_guid The owner + */ + function clear_annotations_by_owner($owner_guid) + { + $owner_guid = (int)$owner_guid; + + $annotations = get_data("SELECT id from {$CONFIG->dbprefix}annotations WHERE owner_guid=$owner_guid"); + $deleted = 0; + + foreach ($annotations as $id) + { + if (delete_annotation($id)) // Is this the best way? + $deleted++; + } + + return $deleted; } /** -- cgit v1.2.3