From 0d12092d4c5ca62247fe8495dbb78adfc134691e Mon Sep 17 00:00:00 2001
From: Greg Froese <greg.froese@gmail.com>
Date: Wed, 20 May 2009 13:36:51 +0000
Subject: fixed most viewed for yourself and friends

---
 friendmostviewed.php | 5 ++---
 yourmostviewed.php   | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/friendmostviewed.php b/friendmostviewed.php
index 8f6299c0d..5c4ec91f4 100644
--- a/friendmostviewed.php
+++ b/friendmostviewed.php
@@ -27,7 +27,6 @@
 		list($pagename, $friendname) = split("/", $page);
 	}
 	$user = get_user_by_username($friendname);
-	
 	global $CONFIG;
 	$prefix = $CONFIG->dbprefix;
 	$max = 24;
@@ -39,7 +38,7 @@
 			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 . "
+			WHERE ent.owner_guid = " . $user->guid . "
 			GROUP BY ent.guid
 			ORDER BY views DESC
 			LIMIT $max";
@@ -48,7 +47,7 @@
 
 	$entities = array();
 	foreach($result as $entity) {
-		$entities[] = get_entity($entity->entity_guid);
+		$entities[] = get_entity($entity->guid);
 	}
 	
 	$title = sprintf(elgg_echo("tidypics:friendmostviewed"), $friendname);
diff --git a/yourmostviewed.php b/yourmostviewed.php
index 18936bd69..ffcdb50ad 100644
--- a/yourmostviewed.php
+++ b/yourmostviewed.php
@@ -21,7 +21,7 @@
 			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 = " . $viewer->guid . "
+			WHERE ent.owner_guid = " . $viewer->guid . "
 			GROUP BY ent.guid
 			ORDER BY views DESC
 			LIMIT $max";
-- 
cgit v1.2.3