]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
fixed minor bug in finding recently commented images
authorGreg Froese <greg.froese@gmail.com>
Wed, 12 Aug 2009 20:49:47 +0000 (20:49 +0000)
committerGreg Froese <greg.froese@gmail.com>
Wed, 12 Aug 2009 20:49:47 +0000 (20:49 +0000)
recentlycommented.php

index aabf5cd9a14875377a68adb9cf20fd334634632f..bfb64981d109d16a57dc876508672d7eaaf623e3 100644 (file)
        //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);
                }
                if(count($entities) >= $max) break;
        }
+       
+       $user = get_loggedin_user();
+       if( $user->guid == 9 ) {
+               echo "<pre>";
+               var_dump( $sql);
+//             var_dump( $result );
+               echo "</pre>";
+       }
        $title = elgg_echo("tidypics:recentlycommented");
        $area2 = elgg_view_title($title);
        $area2 .= elgg_view_entity_list($entities, $max, 0, $max);