From 11aeff6016e8ee586c85913d315c0a5cb0c9fe09 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 14 May 2008 11:10:54 +0000 Subject: - Patch #145242 by douggreen et al: refactor node_rank to modules can add scoring factors. --- modules/comment/comment.module | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules/comment/comment.module') 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)), + ), + ); +} -- cgit v1.2.3