From e24b8c6a1fb6c403ee39094dcfcb57b28faa9f89 Mon Sep 17 00:00:00 2001 From: Greg Froese Date: Wed, 12 Aug 2009 20:49:47 +0000 Subject: fixed minor bug in finding recently commented images --- recentlycommented.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/recentlycommented.php b/recentlycommented.php index aabf5cd9a..bfb64981d 100644 --- a/recentlycommented.php +++ b/recentlycommented.php @@ -17,15 +17,14 @@ //this works but is wildly inefficient //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - $sql = "SELECT distinct ent.guid + $sql = "SELECT distinct (ent.guid), ann1.time_created FROM " . $prefix . "entities 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 = 'generic_comment' - GROUP BY ent.guid - ORDER BY ann1.id DESC + AND ms.string = 'generic_comment' + ORDER BY ann1.time_created DESC LIMIT $max_limit"; $result = get_data($sql); @@ -37,6 +36,14 @@ } if(count($entities) >= $max) break; } + + $user = get_loggedin_user(); + if( $user->guid == 9 ) { + echo "
";
+		var_dump( $sql);
+//		var_dump( $result );
+		echo "
"; + } $title = elgg_echo("tidypics:recentlycommented"); $area2 = elgg_view_title($title); $area2 .= elgg_view_entity_list($entities, $max, 0, $max); -- cgit v1.2.3