Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I like this module, it is nice, but I missed block for displaying high rated nodes, so I did a block (I'm using drupal 2 days, so there should be errors, please correct me, if something is wrong) - but I tested it on drupal 4.6.3 and voting 4.6.0 and everything seems to work. So here we come:
$min_votes = 1;
$max_items = 10;
$node_type = 'page';
$most_rated = db_query("
SELECT title, content_id, count(content_id) as cnt, sum(vote)/count(content_id) as rating
FROM votes
LEFT JOIN node ON content_id = nid
WHERE type = '$node_type'
GROUP BY content_id
HAVING cnt >= $min_votes
ORDER BY rating desc
LIMIT $max_items
");
while($rated_post = db_fetch_object($most_rated)) {
$output[] = l($rated_post->title, "node/$rated_post->content_id") . "($rated_post->rating)<br />";
}
print theme_item_list($output);