There are a few bugs in the module as it stands.
1. there's a closing
instead of an opening
in the function toplist_view() at this line:
$output = '<div class="node-toplist"><div class="content"></p>';
So to fix this, simply remove the /
2. the page listing all approved sites doesn't list the sites in the reverse order, because the SQL query is wrong, again in the toplist_view() function you have this line:
pager_query("SELECT * FROM {toplist} WHERE status = " . SITE_PUBLISHED . " AND total_hits >= " . variable_get('minimum_global_hits', 0) . " ORDER BY total_hits, site_name, site_url DESC", $list_no);
To fix this, the end should be changed to:
ORDER BY total_hits DESC, site_name, site_url
3. the block listing works not perfectly, it lists the sites with most recent (24h) hits, but it also list other sites if there isn't enough sites with recent hits to fill the maximum number of sites to display in block (for instance only 2 sites received hits, but you want to display 10 sites in a block, so the next 8 sites will be displayed in an order which is not relevant)
To fix it you need to change in the function
$sites = db_query("SELECT a.rid, a.site_url, a.site_name, a.total_hits, COUNT(*) AS hits FROM {toplist} a LEFT OUTER JOIN {toplist_log} b ON a.rid = b.rid WHERE a.status = " . SITE_PUBLISHED . " AND (b.timestamp IS NULL OR b.timestamp >= UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 24 HOUR))) GROUP BY a.rid ORDER BY hits DESC LIMIT 0,%d", variable_get('sites_to_show', 25));
simply replace the end with this to reward the sites sending most referrals, if there's enough space left, even if they didn't perform well in the last 24h:
GROUP BY a.rid ORDER BY hits DESC, a.total_hits DESC, a.site_name, a.site_url LIMIT 0,%d
Hope this helps, I'm not using CVS so I'm not doing a patch, those are fairly easy fixes that the module author can do.
I too would like to see a D6 version, it would be nice because no new site is being created with Drupal 5 nowadays, all useful modules have been ported to D6, except this one...
Comments
Comment #1
alliax commentedI can't edit my issue, so:
For the bug #1, I'm talking about a closing P : < / P > that needs to be an opening P : < P >
For the bug #2, I'm saying that at the time of writing, the order is not correct, the sites with most total hits are displayed at the end of the list, the correct order is sites with most total hits are displayed first.
For the bug #3, the name of the function is toplist_block()
Comment #2
olivo.marco commentedThanks for your help, I have checked in your changes - which were all correct.
As for the DP6 version, as I said in another request I don't have time to do it, unluckily, and don't currently need it for any site at all.
If somebody does it, I would be happy to evaluate it and insert it in the CVS.
Thank you, bye,
Marco
Comment #4
wwwoliondorcom commentedSo sad if we never see a D6 or D7 version...
Thanks anyway.