Five Star Rating

This simple WordPress plug-in allows viewers to rate a post.

jQuery showMessage

This jQuery plug-in allows you to easily create a 'twitter-like' notification.

Web Tips

Sharing our knowledge of CFML & jQuery and many other web development tips.

Five Star Rating WordPress Plugin

97
By admin in : Plugin, Wordpress // Aug 25 2010

Two quick videos showing how to install, activate, configure and use this plugin are at the bottom.

Please check out the FAQ before you ask for support.

Thanks to some helpful critics and tips from users, we have taken our very first plugin and retooled it to be more flexible and easier to implement into your posts and pages.

If you used our previous plugin (Contestant Rating WordPress Plugin), you will be happy to learn that this new plugin is a great replacement.

  1. Use shortcode to display your  ratings. We have incorporated the use of shortcode into the plugin so you are no longer required to edit your template.
    Because it was our first plugin, we did not have the vision to incorporate this in the first iterations. We have done our homework and thanks to the help of other great WordPress users, we have created methods to display the Five Star Rating plugin, ‘Best of the Month’ and ‘Best of the Moment’ using a simple shortcode.
  2. You set the cookie.
    We did two bad things with the cookie in the first plugin. First we hardcoded it and second we set the expiration for one year in the future. Of course this worked for us, but we realize now that you might have other uses for the plugin. Therefore we have added the ability for you to set your own cookie expiration for as little as 1 minute to 12 hour to 365 days (or more if you like).
  3. Make it your own.
    We originally ported over an existing WordPress plugin and that plugin had more then one look. Unfortunately we did not have the vision to plan for using more then one look. Well not anymore! We have added the ability to theme this plugin as you see fit (more instructions on how to do this will follow). Currently there are two themes, but we have added the flexibility into the plugin to allow you to theme it as you like. It is as simple as adding an attribute to your short code…. like this:

    [five-star-rating star_type="abuse"]

  4. Help us keep improving.
    If you run into an issue, would like to request a feature or just want to tell us what a great plugin this is, be sure to post a note to us. Of course if you run into an issue, please don’t just say ‘It doesn’t work!’ or ‘This plugin sucks’ as 9 times out of 10 the plugin is working fine and as we intended, but the plugin is not being implemented correctly. We like criticism, but please make it constructive.

Here is the plugin in action. Rate this post!

381 votes Cast your vote now!
powered by Five Star Rating

Here are some stats for the month.

We have more work to do as far as documentation and such, but this was just so exciting, we had to get it out now. More will follow in the future.

Download the latest version now from wordpress.org

Installation option number one:
httpvh://www.youtube.com/watch?v=yQD-3Gwy2og

Installation option number two:
httpvh://www.youtube.com/watch?v=MBGhxegPm_M

video platform video management video solutions video player

About the Author

admin has written 22 articles for dingobytes.

Andrew Alba is a Software Engineer who recently relocated to Minneapolis-St Paul area after living in NW Minnesota for two decades. Andrew is currently employed with Internet Broadcasting Systems in St Paul, MN after spending almost five years with Interive Media Group in Fargo, ND. Andrew enjoys developing solutions using CFML, JavaScript, AJAX, PHP and anything else he can steal from the web.
  • http://www.albawebstudio.com admin

    First things first, I am assuming you placed the [five-star-rating] in the post where you want it to appear.

    If you can see the plug-in but it isn’t recording any votes, then there might be some other javascript error on your page. Try changing your site to the default WordPress template and test it. If not, send me a link to a post with the plugin is showing.

  • http://www.albawebstudio.com admin

    Thanks for the question. You can modify the cookie however you feel. I only used IP, because it was something I thought could be useful in later iterations of the plug-in. The fact is that currently there is nothing stopping multiple votes in the database other then the cookie.

    So what does this mean you might ask? Well it means we are only doing a “client” side check and not a server side check. This is intentional as we didn’t want to completely block the ability of one or more machines from the same IP from being able to vote. The draw backs are that people could “cheat” the system this way by manipulating their browser (clearing the cookie) or by using multiple browsers.

    So in summary, you can create the cookie with what ever data you like, but it won’t be necessary in your scenario as that should not be a problem. If you want the plug-in to be cheat proof, it would require more logic on the client side and much more logic on the server and database.

    Hope that helps!

  • ems

    Sounds good. After testing and looking at how you defined the cookie in the php file, i noticed that it was cookie only based. I don’t know where i thought it was ip blocking…

    Also i purchased / downloaded the Advanced version of your plugin and it seems to be exactly the same as the free one. Is there a difference or just a way to donate for the plugin? No worries since it was only $2… just curious if there were differences.

    Do you currently support both or should i be using the Free version since i noticed that the Release version as 1.2 on the free one and the bought / advanced one was 1.0?

    A nice option to add would be a drop-down in the admin menu to select the cookie type (e.g IP & User, IP, Cookie Only, Users of WP, etc)

    Thanks

  • http://www.albawebstudio.com admin

    Thanks for purchasing the premium version. It helps us keep making improvements to the premium version. There are some differences between the free and premium versions.

    Amount of support
    Extra images (abuse, thumbs and smilies)
    More options (FSR_best_of_month and FSR_best_of_moment)
    More features planned (such as multiple ratings per post, widget, best of …, etc) and will get free updates when they are available

    We only give limited support to the free version and will likely remove support all together for free version once we build up a good FAQ on it.

    The version number for the premium version is different from the free version as it is in it’s own repository. Because we plan on improving the premium version more to separate it from the free version, we thought it would be best to keep the versioning separate as well.

    Thank you for the suggestion. It is great to get constructive criticism and new ideas from people. When you work on something for so long you lose the creativeness that started the project.

  • JohnG

    Greetings, love the plugin, but I’m having problems with it in Chrome. When something is rated and the page reloads to show the average rating, the entire page gets duplicated within the content area.

    If you reload the page, everything looks fine again, but obviously it’s rather problematic.

    It doesn’t affect IE or Firefox.

    Any ideas?

  • http://www.albawebstudio.com admin

    JohnG,

    Chrome happens to be my browser of choice. When I test the current plug-in on this site, it works fine. If you are having a problem, first test this site w/ your browser (it should work fine). That would lead me to believe it is an issue with your template, another plugin or your install.

    First try viewing the install video. If you are confident it is installed properly, try setting the template of your WordPress install to the WordPress default template. If it still does not work, try removing any other plug-ins that might be active (one at a time so you know which ones).

    Hope you find the issue.

  • JohnG

    Well, I sort of figured it out. Basically it’s only a problem on posts where the [five star rating] code is placed inside of a table. When I move the code outside the table it works fine.

    The only problem with that is now the rating is not where I’d like it to be so my design is a bit messed up.

    Hopefully I can figure something out with it.

    Thanks.

  • http://www.muzikadresim.net Cüneyt Çil

    hi,
    thank for plugin.

    how i can show FSR_best_of_month in php?
    i want to show it on my theme widget.

  • http://www.albawebstudio.com admin

    Sorry that I can’t really help you with your request other then to say try to echo out the FSR_best_of_month_func() < ?php echo FSR_best_of_month_func('star'); ?>

  • http://depts.washington.edu/uwstory Harry Hayward

    We’d like to use the FSR in conjunction with a vodpod video gallery to collect “people’s choice” votes in a student film festival. Having trouble integrating the two plug-ins – any words of wisdom?

  • http://www.albawebstudio.com admin

    Would be happy to help you try to get this going. What exactly is the issue? Any examples of the page?

    If you let me know what you want and what the issue is, I will do my best to get something working for you.

  • http://depts.washington.edu/uwstory Harry Hayward

    Thanks Admin – I just published the page so we could both look at it.
    http://depts.washington.edu/uwstory/wordpress/events/2010-festival/peoples-choice-gallery/

    We expect 50+ entries, and would like to award a People’s choice award based on the votes cast by visitors to the site. We’re interested in their ratings, and in how many people vote for an individual entry.
    harry

  • http://www.albawebstudio.com admin

    A lot of this would depend upon your WordPress installation. I can only tell you how I would do it.

    First, I should state that my Permalinks are setup using /%category%/%postname%. I am not sure how your WordPress install is, but these instructions would assume you could use the same permalink settings.

    I would create a separate post for each entry. In that post you would put the fsr shortcode or since there are a lot you could use the method to provided to insert into your WordPress template. All of the posts would use the same category for each entry. So for an example, we will say you want it to be a category named ‘peoples-choice’, you would create a post for each entry and assign it to the peoples-choice category. Then you could direct your traffic to http://yoursitename/peoples-choice/ and all the posts would show up on that link. They can of course drill down to individual post level and vote too.

    Hope that helps.

    Here is an example of something similar someone has done using the plug-in [http://peopleofdahood.com/photos]

  • http://depts.washington.edu/uwstory Harry Hayward

    Great! thanks a lot. We’ll try it out and send an update.

  • Juan López

    I am using your plugin in a web site (http://www.navarraasi.es/category/expresate/) but I need to translate it to spanish language. How can I do that?

    Also, I buyed the Premium Version. Where can I download the updated versions?

  • http://www.albawebstudio.com admin

    You could contribute to the plug in by downloading and completing the POT file here.

    Once you have done that, you can forward it to me and I will incorporate it into the plugin [I can send you my email].

  • Craig

    This plugin doesn’t work in chrome for me either. This includes your example on this post.

  • http://www.albawebstudio.com admin

    Craig,

    This plugin DOES WORK in chrome. If it is not working for you in your Chrome, there are several explanations why that is, but it is not the plugin. the most likely culprit is either your WordPress theme or another WordPress plugin is bad. Please read the FAQ for more information. There is a video on the bottom of the FAQ page that shows that the plugin works in the Chrome browser.

  • http://www.youcanbesuccessfulontheweb.com Gene

    This is almost perfect for what I’m looking for. It would be ideal if there was a way to limit voting to people who have already registered at the site so only registered users could vote. I’m getting ready to launch another site in the next 60 days and would use this to control weekly contests where registered users would vote for the best post and video and this highest vote totals (no duplicate voting allowed) would receive a cash prize of $50 each week.

    Would it be possible to incorporate an option in this to limit voting to both IP address and registered users?

  • Tim Mulder

    missing /div in fsr.class.php, useless /span…. your comments allow html…

  • http://www.comparefaxproviders.com Cameron

    I run a comparison website and I wanted to add the ability to have users review the services provided. This plugin is working great for me. But what I would like to know is if there is some way I can post the rating of all of the services side by side like in a table or something? So a user could look and see that most people voted this service 5 stars and then from the information page about the service they could do the voting. So you couldn’t vote from this main page but you could see how many starts each service got. Could I do that somehow?

  • Anonymous

    It is possible, but there is nothing written as of yet that would do it. One possible way you could do it would be as recommended in the FAQ. Other then that, feel free to alter the plug-in as you like.

    Until then I will add it as a feature request.

  • Kemper

    Is there a way to run the plug-in for a limited amount of time, and then when the contest is over still display the ratings at the time it ends without allowing people to continue rating? This is important to validate winners after the fact, but not let the results get distorted at the same time.

  • Anonymous

    Really awesome plugin! However, one strange thing is that once I´ve done the rating and reload the page, my sidebar is now at the bottom of the page =P

  • http://buildachickencoopplans.net Azim

    Hi.. Can I alter the plugin so that it can display more than one rating on one post?

  • Anonymous

    Yes, you can alter the plugin how ever you wish as long as you keep the license as it is. If you would like to share your changes, email them to us here and we will look at adding them to the free version.

  • Promocraze

    Go to the settings area and select “hide credits”. Happened to me also, and when I did that, it fixed it :)

  • melmarie

    Love this! how/where can a change the default text “Cast your vote now” to “Rate this”?

  • Romik

    Hi there,
    I tried to modify the plugin to get quarter stars but with no luck. Would you have some solution for this? Of course if it’s not complicated. Just wondering :)

  • Nikolai

    There is a big problem with the plugin and I hope that the author sees my comment. When you load the page for the first time, it will not let you vote, because there is no cookie created. Try it, just clear all cookies in your browser or use new browser and you will not be able to vote until you reload the page or visit another page.

    I think I managed to fix this though. You need to change the line:

    if ($rated || !isset($_COOKIE['wp_fsr']) {

    to

    if ($rated) {

    This is in the fsr.class.php file.

    Regards.

  • David

     Reference http://www.boomercafe.com with hundreds of stories, how is it possible to add Five Star Rating to all stories at once rather than one at a time … or is that not possible?

  • Anonymous

    Please see the FAQ. There are instructions there.

  • Inside Out

    Nice plugin, but the stars are a little too yellow for me and I’ve looked at the CSS and the images and I’m just not seeing how to change them. I’m sure it’s simple. Thanks.

  • Jeb

    Hello,
    Great plugin, thanks. I’ve got it working/looking as I’d like. I have one question tho…I set it up on a new site with a few Test Posts, but now that I’m ready to go live with the site, I deleted the Test Posts, but the Star Ratings, along with a count (1 Vote) still appears on the page I have set to show the top rated posts. The titles of the posts are gone but the ratings are still there.

    Is there a way to reset or clear the plugin so I can start fresh with the results?

    Thanks very much…

  • http://www.tablazines.com Tablazines

    Ok I’m running a contest with cookies set to expire in 256 days. Someone figured out that if you close and open the browser.. you can vote again. Since we’re giving out a really big prize.. this is unacceptable. Any way we can fix this?

  • http://www.tablazines.com Tablazines

    Also how do you view the results.. to see who has the highest ratings?

  • Anonymous

    closing the browser would not remove the cookie. Deleting the cookie or using a different browser would be the only way to bypass the cookie check.

    That said, the current system has no “fail safe” way of avoiding fraud at this time. Sorry about that. In order to avoid fraud, you would need the user to use a log in before voting.

  • Jessica Holbrook

    I’m in Chrome and even though I set the cookies to 365 days, all I have to do is refresh my browser and it lets me vote over and over again. 

  • Anonymous

    I can not duplicate your results. The only way to vote again is via a different browser or clearing cookies.

  • Karen

    Hi. Is there any way to hide the number of votes? The reaosn being that I send RSS campaigns through Mailchim and it embeds the plain text “numbe rof votes” into my email campaigns – lookign messy.

  • Steif

    Is it possible to only allow admins to vote?

  • Anonymous

    Sorry for the late reply. Seems an update to the new All-In-One plugin borked my admin.

    Short answer is yes it can be done, but would require you to insert the call to the plugin within the correct wordpress permissions call.

    Here is a link that should help you do what you need… http://codex.wordpress.org/Function_Reference/current_user_can

  • LX

    A question?
    is it possible just to have the single number of click over star 1 star 2  and not the average?
    thank you

  • Anonymous

    I am not completely sure what you mean, but I think what you are asking is if you can show two complete starts instead of one and a half stars?

    That is not a current feature, but you could edit the three methods in fsr.class.php. Those would be the _drawStars(), _drawVotingStars() and _drawVotingStars().

  • Vee

    I tested the 5-star rating in Chrome and it is not working. Tested both my installation and your rating up above and they do not work. 

  • Anonymous

    I didn’t get a notification of this message, so that is why the response is 3 weeks late.

    I use Chrome as my browser and I can assure you that the plug-in does work in chrome on dingobytes.com

    Please see the FAQ if you are having an issue.

  • Mike

    Hi
    Like the simple plugin – does what it says on the tin!!!!

    I’m using the direct function in the single page loop which works well.  

    What I would like is a widget/php page that would enable me to get say the 5 top posts in a ‘titled’ list with the star rating?  Be nice to be able to also use/change to an alternative image in the rating so it was proportional to the side of the side bar?   If you use most star ratings plugins with images set up for the post page, the stars look too big in the sidebar.

    many thanks
    Mike