Created
March 1, 2013 16:35
-
-
Save ringmaster/5065881 to your computer and use it in GitHub Desktop.
Get Habari posts ordered by how many comments they have
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$presets['most_comments'] = array( | |
'on_query_built' => function(Query $query) { | |
$query->join('LEFT JOIN {comments} c ON c.post_id = {posts}.id'); | |
$query->groupby('{posts}.id'); | |
$query->orderby('count(c.id) DESC'); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment