PDA

View Full Version : Order By Votes 0.2



Nick
03-24-2010, 05:14 AM
Order By Votes
Version: 0.2
Author: Nick Ramsay
Created on: 2010/03/24
Last Updated: 2010/06/04
Tested on: 1.3.0 ~ 1.4.1
Plugins Required: Bookmarking
Plug & Play: Yes
Supported: Yes

Description
A simple plugin to change the default sorting order of the index page to "most votes" instead of "date".

Instructions
1. Upload the "order_by_votes" folder to your plugins folder.
2. Install it from Plugin Management in Admin.

Note
This plugin sorts by "post_votes_up" only, so it's suitable for sites using the Vote (http://hotarucms.org/showthread.php?78-Vote-1.4) plugin, but not the Up Down Voting (http://hotarucms.org/showthread.php?485-Up-Down-Voting-0.2) plugin.

The Code
This plugin is so basic, I thought I'd share the code with you! :cool:

class OrderByVotes
{
/**
* Override the default sort filters for the front page
*/
public function bookmarking_functions_preparelist($h)
{
if ($h->pageName != 'popular') { return false; }

$h->vars['orderby'] = 'post_votes_up DESC, post_date DESC';
}
}Revision History
v.0.2 2010/05/28 - Nick - Updated for compatibility with the Bookmarking plugin
v.0.1 2010/03/24 - Nick - Released first version

Please click "Rate Thread" and give this plugin a rating. Thank you.

Tony
03-24-2010, 05:06 PM
Nick, i am getting this error when trying to install this pluging

uh-oh, file '/home/content/plugins/order-by-votes/order-by-votes.php' not found in class.metadata.php

Nick
03-24-2010, 11:22 PM
The plugin's folder name should be order_by_votes and the file order_by_votes.php, i.e. with underscores.

/content/plugins/order_by_votes/order_by_votes.php

Tony
03-25-2010, 02:46 AM
thanks a lot Nick that was it!..

daveryder
03-25-2010, 04:13 AM
Exactly what I needed! (is nick a mind reader....from the future?)

It's coffee time :)

Nick
03-25-2010, 04:54 AM
It's coffee time :)

Yay! Thanks Dave!

:slurp... ouch! hot!: :o

adriansonline
09-21-2010, 11:36 PM
Hi Nick,

This plugin is not working for me. Is it broken in 1.4.1? I am using the normal vote plugin. I cleared the cache, but a post with Zero votes is still above one with 2. Any ideas?

Nick
09-21-2010, 11:42 PM
I've just tested it on 1.4.1 and it works. Are you sure you're looking at the "popular" page?

adriansonline
09-21-2010, 11:49 PM
Hi Nick,

I had set the default as "all" in bookmarks plugin. I have a site where people will vote on something. Not much will be added beyond what me as admin has added. So upcoming and latest are really not needed for me (working on figuring how to remove those). I will just set all to "top" and it will work.

alexcaro
07-17-2012, 12:26 AM
Hi,

Is it a possibility to get same function with Up Down Voting? My site is a Contest site using Up Down voting.

Thank you
http://www.bestclub.xxx