diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-05-14 11:10:54 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-05-14 11:10:54 +0000 |
commit | 11aeff6016e8ee586c85913d315c0a5cb0c9fe09 (patch) | |
tree | 4f5b6274b80557fc987c36f62205cef3545d3b39 /modules/comment/comment.module | |
parent | 658b27c9eceed3c66c9fd4c75da9d9f0cdfd839c (diff) | |
download | brdo-11aeff6016e8ee586c85913d315c0a5cb0c9fe09.tar.gz brdo-11aeff6016e8ee586c85913d315c0a5cb0c9fe09.tar.bz2 |
- Patch #145242 by douggreen et al: refactor node_rank to modules can add scoring factors.
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)), + ), + ); +} |