aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/annotations.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-22 15:20:13 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-22 15:20:13 +0000
commit8b5fd806d6871aaeb179376328a8af215ed44f88 (patch)
treea31f8cc50864e11f850e610eaa2877e8f4419e45 /engine/lib/annotations.php
parentd99f1028ce873ab99c345dcea5b4fba67d73203d (diff)
downloadelgg-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/annotations.php')
-rw-r--r--engine/lib/annotations.php21
1 files changed, 21 insertions, 0 deletions
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;
}
/**