diff options
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r-- | modules/comment/comment.module | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index ead3cc906..88794bd5d 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1970,3 +1970,18 @@ function comment_unpublish_by_keyword_action($comment, $context) { } } } + +/** + * Implementation of hook_ranking(). + */ +function comment_ranking() { + return array( + 'comments' => array( + 'title' => t('Number of comments'), + 'join' => 'LEFT JOIN {node_comment_statistics} node_comment_statistics ON node_comment_statistics.nid = i.sid', + // Inverse law that maps the highest reply count on the site to 1 and 0 to 0. + 'score' => '2.0 - 2.0 / (1.0 + node_comment_statistics.comment_count * %f)', + 'arguments' => array(variable_get('node_cron_comments_scale', 0)), + ), + ); +} |