aboutsummaryrefslogtreecommitdiff
path: root/friendmostviewed.php
diff options
context:
space:
mode:
Diffstat (limited to 'friendmostviewed.php')
-rw-r--r--friendmostviewed.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/friendmostviewed.php b/friendmostviewed.php
index a196f51af..4f832b228 100644
--- a/friendmostviewed.php
+++ b/friendmostviewed.php
@@ -40,6 +40,19 @@
WHERE ent.owner_guid = " . $user->guid . "
ORDER BY (views+0) DESC LIMIT $max";
+
+ $sql = "SELECT ent.guid, count( * ) AS views
+ FROM `my_elggentities` ent
+ INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
+ AND sub.subtype = 'image'
+ INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
+ INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
+ AND ms.string = 'tp_view'
+ WHERE ann1.owner_guid = " . $user->guid . "
+ GROUP BY ent.guid
+ ORDER BY views DESC
+ LIMIT $max";
+
$result = get_data($sql);
$entities = array();