diff options
author | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-21 16:22:19 +0000 |
---|---|---|
committer | dave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-21 16:22:19 +0000 |
commit | 64be91148a881f65224c583b92c407205db24634 (patch) | |
tree | 3b4eba097b3fa6e990091c7b882642fe139f86c6 /engine/lib/annotations.php | |
parent | ad745e050da855d326d1b6bc3df8032c05574392 (diff) | |
download | elgg-64be91148a881f65224c583b92c407205db24634.tar.gz elgg-64be91148a881f65224c583b92c407205db24634.tar.bz2 |
generic like this functionality added
git-svn-id: http://code.elgg.org/elgg/trunk@5456 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r-- | engine/lib/annotations.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index b18475d57..b7dc1b9d3 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -1250,6 +1250,29 @@ function get_annotation_url($id) { return false; } +/** + * Check to see if a user has already created an annotation on an object + * + * @param ElggEntity $entity + * @return true | false + */ +function elgg_already_created_annotation($entity_guid, $annotation_type) { + global $CONFIG; + $entity_guid = (int)$entity_guid; + $annotation_type = sanitise_string($annotation_type); + $owner_guid = get_loggedin_userid(); + $sql = "select a.id" . + " FROM {$CONFIG->dbprefix}annotations a, {$CONFIG->dbprefix}metastrings m " . + " WHERE a.owner_guid={$owner_guid} AND a.entity_guid={$entity_guid} " . + " AND a.name_id=m.id AND m.string='{$annotation_type}'"; + //get the annotation type id + $check_annotation = get_data_row($sql); + //check to see if the user has already liked + if($check_annotation) + return true; + else + return false; +} /** * Register an annotation url handler. |