[ Content | View menu ]

Rate My Stuff Version 1.1

Written on October 1, 2005

Rate My Stuff is now two plugins: the “classic” in-post tag syntax version and a custom field variant that lets you add the rating as metadata to your post.

Enjoy! :)

Filed in: WordPress.

48 Comments

Write comment - TrackBack - RSS Comments

  1. Comment by thesuperstar:

    very nice. thanks. just what i was looking for.

    October 2, 2005 @ 11:51 pm
  2. Comment by Gabriel Stevens:

    I’ve been searching for a few days for a way to allow users to rate a post when they leave a comment. My mental image here has a “Rate Post” dropdown that lets users choose a number between 1 and 10 and then converts it to a star rating and places their rating of the post in their comment, and ideally, an average rating from all the posts, in the posts header.
    I was very excited to stumble across your plugin, as it’s the closest I’ve come yet to what I want, but I’m not a programmer by any means, and have no idea how to implement what I’m envisioning. I was hoping you might have some advice for me on achieving the result I’ve described above.

    October 3, 2005 @ 11:47 pm
  3. Comment by thesuperstar:

    i was wondering how do i change the size of the stars, i would like to make them smaller? i read your core.php and i couldnt get it to work.

    October 6, 2005 @ 12:04 am
  4. Comment by Chris Coleman:

    superstar: You’ll have to make new star images. Alternatively, you could probably easily stick in the code to put sizes for the images in plugin. Dave left out the image sizes to make it easier for you to use your own images for the stars.

    October 6, 2005 @ 1:43 pm
  5. Comment by Dave:

    Hi guys, glad you like the plugin! :)
    Gabriel, you can try this plugin, though I’ve never tried it myself. It appears to use a shaded-bar rather than stars, but I’m not sure if it’s customizable or not.

    October 6, 2005 @ 9:47 pm
  6. Comment by Michael:

    This is just perfect!
    I’m going to use it to rate the concerts that I’ve attended, the books I’ve read, the movies I’ve seen and…
    Yeah, just perfect! Thanks.

    October 15, 2005 @ 12:06 pm
  7. Comment by Dave:

    Thanks for the kudos, Michael! Let me know if you have any questions or suggestions.

    October 15, 2005 @ 12:09 pm
  8. Comment by Michael:

    Well, just one small problem: I’ve changed the Maximum numer of stars to 6 instead of 5, but when I use the rating 5.5 i shows an ekstra blank star at the end (to make it 7 in total) - You mention something about that in the core.php, but I can’t seem to figure out what to do, to get it right?

    October 21, 2005 @ 5:51 pm
  9. Comment by Michael:

    I’ve solved my little problem, finally…
    I’ve changed the code in the core.php from:


    if ($nums[1] == 5

    if (!$skip_one_blank and $nums[1] == 5) {

    to:


    if ($nums[1] == $max_stars

    if (!$skip_one_blank and $nums[1] == $max_stars) {

    The only thing to remember, then, is to use the number of $max_stars as “the magic number”.
    In my case that would be “.6″ (if you change the maximum number of stars to, let’s say 10, it would be “.10″).
    Thanks again Dave, for a great plugin!

    October 27, 2005 @ 9:31 am
  10. Comment by Phil Wilson:

    Hiya, do you know about hReview? It would be really great if your plugin could output that!

    November 15, 2005 @ 6:52 pm
  11. Comment by Dave:

    Hi Phil,

    Looking over hReview, it appears to be geared towards capturing the entire review, rather than just the rating. This plugin only handles the actual star rating. The Structured Blogging plugin is probably more appropriate for hReview output.

    November 15, 2005 @ 9:56 pm
  12. Comment by Malik:

    Hey! I wanted to know if there is away to implement this to work within the comments as well so that Users can use [rate 5] or something like that and it’ll put in the images. If you can recommend a way to implement this let me know. Thanks!

    November 18, 2005 @ 12:41 pm
  13. Comment by Stephen:

    I really like this plugin, but I use different images to rate differnt things on my site. I have customized the pluggin with one set of my rating images, but it would be great if the plugin could be altered to include a choice of multiple image sets.

    I envisage it being an extra tag in the syntax

    eg. [RATE IMAGESETNAME 3.5] where IMAGESETNAME is the image set that you would like to use.

    I’ve no idea about code, but is it possible to do this?

    November 19, 2005 @ 2:42 am
  14. Comment by Dave:

    Malik,

    Sure! You can add the plugin to as many filters as you like. You can see a list of common filter hooks here: http://codex.wordpress.org/Plugin_API#Filters

    In the file rate-my-stuff.php just insert the following line for each filter you want:

    add_filter(’the_content’, ‘rate_my_stuff’);

    Change the_content to whatever filter you want to use. I would try comment_text for the effect you want.

    P.S. Nice fork icons! :)

    November 19, 2005 @ 1:12 pm
  15. Comment by Dave:

    Stephen,

    I see two approaches you could try. First, you could rewrite the function rate_my_stuff (located in file rate-my-stuff.php) and modify the way the regular expression search finds the tag. That’s how it identifies the [rate 5] pattern I created for the plugin, so you’d have to modify the expression to include a search for your imageset. Then you’d have to modify the core.php file’s function to accept the imageset as a parameter.

    Have fun. :)
    OR…

    Just copy the plugin under a different plugin name, say “Rate My Stuff (Imageset 1)” (and change the filenames, obviously) and hard-code the imageset into the $rate_path variable at the top of the core.php file for each plugin. In other words, in your Plugin Management screen, you’d have a separate plugin for each imageset.

    Kind of sucks, I know, but it should work.

    If you do that, let me know if it does work for you, I’m interested in seeing if it does.

    November 19, 2005 @ 1:20 pm
  16. Comment by Dayna:

    Hello there, I tried this plugin on my WP 2.0, the plugin has no errors etc, just the the images just don’t show, the links is right and the images are in the right folder, but I have no idea why the image don’t show. Is there any fix to that or something?

    Thank you

    January 1, 2006 @ 7:12 am
  17. Comment by Dave:

    Dayna,

    I am not currently using WP 2.0, so I have no way personally to check and see if the problem is with WP 2.0’s plugin architecture. I know they shifted a bunch of stuff around on the backend, but I’m not sure what all changed yet. I understand they know it breaks several plugins, though.

    Check the URLs generated for the images in the rendered page’s source code. See if those resolve to the images or not. I doubt they do, but it’s one more thing to rule out.

    January 1, 2006 @ 11:48 pm
  18. Comment by Dayna:

    Thanks Dave for the reply.

    I’ve fix it thanks to your reminder. In the core.php I’ve edited it to
    $rate_path = get_bloginfo('url').'/wordpress/wp-content/plugins/rate-my-stuff/';

    because my wordpress is in a seperate folder and it worked after that.
    :)

    January 2, 2006 @ 4:14 am
  19. Comment by kili:

    i have installed the plugin but could someone point to me where to place the code

    <?php show_post_rating($post->ID); ?>

    i am using WP 2.0
    Thanks.

    January 3, 2006 @ 2:39 pm
  20. Comment by Dave:

    kili,

    The bit of code you specified is for the Custom Field Variant. That code must be placed into your template file. Where is up to you. Wherever you put the code, the rating for that post will appear. This ensures the rating appears in the same place for each rated item.

    January 3, 2006 @ 10:28 pm
  21. Comment by Astorg:

    Sorry, but I’m confused. If I use the custom rating (which is the only one that seems to work under WP 2.0, the other one generates an error message on activation), how do Iactually rate each post? I mean, OK I insert the field in the template, but at what point (an how) do I determine that any given film or whatever should be rated on the 0-5 scale?

    Also, is it possible to have twho different sets of post templates? One, say for subjects that don’t require a rating, and another for films/concerts/operas/books or anything else that requires or warrants rating?

    February 12, 2006 @ 10:39 am
  22. Comment by Dave:

    Astorg,

    You rate each post by creating a custom field called rating when you create/edit the post. If you look in the file rate-my-stuff-custom-field.php you will see the following call:

    $rating = get_post_meta($post_id, "rating", true);

    The get_post_meta function queries the database for the current post’s custom field with a key of rating and retrieves its value. So if you create a custom field with a key of rating and give it a value of 3.5, when you load that post (and have the template tags in place, as you said you do) the star images should appear.

    For different post templates, you probably want to take a look at making category-specific templates documented in the Codex. You could have a category for each rateable item, and create a template containing the rating code for each of those categories. If you want to keep it simple, you could probably create a single template for all rateable categories and < ? include(..) ?> it in each category template using PHP.

    Good point on WP 2.0. I haven’t tested on that version, and to be honest probably won’t, at least for a long time. I don’t blog much lately, so I haven’t invested much time in maintaining either the blog or the code. Not to say I won’t fix a major bug, but I don’t have the time to spend checking out all the issues 2.0 may cause with this code.

    Though if you do find a problem and can offer a patch, I’m more than willing to toss it in the code.

    Good luck, and thanks for trying it out! :)

    February 12, 2006 @ 12:39 pm
  23. Comment by Astorg:

    Wow, jolly clear answer… I hadn’t figured out it required using the custom field feature in the admin area. I think it’s cool setting up specific templates for each category that requires rating (books, cinema, theratre etc) and “include” the rating template. All very clear in my mind now, and quite exciting.

    Also the good news is I’ve managed to get the standard plugin to work, basically I’d messed up the path in the core.php file… which seems to be the main difference on WP 2.0 Otherwise, no hassle, it works beautifully, looks at it in action on my site http://astorg.info.

    BTW, one issue I did have was that the gif files you include with the plugin, in addition to being oversized for my subdued taste (which is easily solved by shrinking the size), don’t have a transparent background, which for people like me who are fed up with the trendy, whitey blogs that have been fashionable of late, is a problem : so I cropped the stars in Photoshop and now use the transparent background ones you can see on my site.

    Barring that small detail, I think it’s a brilliant plugin. I’d been lokking for something to do this for weeks and yours seems to be teh only one around… Thanks.

    February 13, 2006 @ 12:55 am
  24. Comment by Dave:

    Sweet. High praise from real users is the best. Glad I could help. :)

    February 13, 2006 @ 11:45 pm
  25. Comment by Edna Melendez:

    Hello,

    I have a script that multi installs and manages wordpress blogs. Can I include your plugin with my package for clients to use?

    http://wordpressmanagerdx.com

    Thank you.

    February 18, 2006 @ 10:36 am
  26. Comment by Breanna:

    I have installed this script on my sisters site, http://ladyinpublic.com , and it worked for the first few days, however now it no longer works and it only shows up as [rate 5]. I have uninstalled and reinstalled rate-my-stuff and it still doesn’t work. I am using wordpress 2.0.

    Do you know of anything else I can do to get this to work? thanks!

    February 23, 2006 @ 5:17 am
  27. Comment by Aneesah:

    I’m having the same problem as Breanna, I just can’t figure out what made it not work anymore… =T I’m using WP 2.0.1.

    February 26, 2006 @ 5:37 am
  28. Comment by Dave:

    No idea. Did you recently upgrade to WP 2? If it worked before but then suddenly stopped, that leads me to believe something in your system changed to prevent it. I don’t run WP 2 so I don’t know if there are any inherent problems with that version, but others run it on WP 2 just fine. Look back over the comments, a couple of people have had problems with WP2 and found solutions to them.

    February 26, 2006 @ 12:53 pm
  29. Comment by tvita:
    hi,
    i had the same problem - when using the classic plugin it only showed up as [rate 5] in the post.
    if you are using wordpress 2 you have to use the custom field method …which actually as smooth as the other version.
    i believe you can tweak core.php and edit the url there to make it work with wordpress 2.
    but i didn’t bother and don’t know how actually.

    anyway i uploaded rate-my-stuff-custom-field.php and activated it. then i put the “My rating: ID); ?>” (without the “) under the post and befor the comment and category starts on the index.php (and in archives acutally too).
    after that i wento to the write option in my admin interface and once wrote “rating” in the custom field area also i set value to 1 (you can customize this later). then write a new entry and selct rating from the custom field dropdown. you leave the key field blank and write the star rating you lige in the value field (for example 2.5). then it will show up under the post button and you can always customize it later and change the stars shown by writing another number in the field you now created.

    March 3, 2006 @ 8:37 am
  30. Comment by Linc:
    Thanks for making the plugin! I’ve just started using wordpress, now I know what custom fields are! Thanks again!
    March 18, 2006 @ 9:47 pm
  31. Comment by ross:

    Is there any way to limit the number of stars?

    Even if I set max_stars to 4, it’s still possible to enter [rate 7] and have 7 stars show up.

    I want to add this to my comment section so people can disagree with my rating, but you know someone is gonna put [rate 300] (which doesn’t work anyway) - but you get my point.

    Thoughts?

    June 8, 2006 @ 2:03 pm
  32. Comment by Rob:

    So with the Custom Field variant, would it be possible to create a page and display all the rated stuffs as links in a table? Wouldn’t that be a valid use of the meta data?

    June 28, 2006 @ 8:59 pm
  33. Comment by Rob:

    I’m not seeing the class “rating” showing up on my pages. I’m just getting the image source with the alt tags:

    Is there something I’m not doing? I’d like to syle this differently than my default img tag styling. Example:

    http://www.electrolund.com/2002/05/the-matrix-vs-dark-city/

    June 28, 2006 @ 9:11 pm
  34. Comment by Rob:

    Well, I got it to work by adding in the class tags in the core.php file. They were actually missing. Weird.

    June 29, 2006 @ 2:36 pm
  35. Comment by game:

    I’ve found a bug using your plugin and changing max-stars to 10. If I rate with 9.5, then appear 10.5 stars. I think I’ve fixed it changing this (line 45):

    if (($nums[0] == ($max_stars - 1)) and ($nums[1] != $max_stars)) { //four stars only, show blank fifth

    to this:
    if (($nums[0] == ($max_stars - 1)) and ($nums[1] != 5)) { //four stars only, show blank fifth

    Maybe you didn’t find this bug because you use 5 stars maximum, which is the same as the “magic number”

    Well, thats all, I think it works OK now. Greetings from Spain, and sorry if my English is not all OK :P

    July 12, 2006 @ 1:52 pm
  36. Comment by Craig:

    Dave,

    Great little plugin. The Custom Field variant is just what I was looking for. It sets it apart from the similar plugin to yours located here.

    Do you plan on evolving this plugin further?

    July 31, 2006 @ 4:07 pm
  37. Comment by Alex Holsgrove:

    Hey there
    Great looking plugin, but I want to limit the rating to my “reviews” category so people can rate music and guitar stuff. How can I do this please?

    Kind Regards

    Alex

    September 5, 2006 @ 2:59 pm
  38. Comment by Liza Marie:

    Great plugin! I love it, thank you for this.

    September 10, 2006 @ 11:21 pm
  39. Comment by RadoNovac:
    Great plugin. Just what i was looking for. Now i can just rate anything i want. Works like a charm. Thanks ! (p.s. Only had to change the path to the image files in core.php.)
    October 16, 2006 @ 7:02 am
  40. Comment by Lu:

    Just what I wanted! I loved the “classic version”! Tks!!!

    October 25, 2006 @ 10:55 am
  41. Comment by Marcel:

    Hi Dave

    Great plugin. I use “custom fields” and it’s just perfect. I would love to use it twice for each post, for two different votings. Is there any way to “copy” the plugin - sorry, maybe it’s really simple, but I’m no programmer.

    Thanks
    Marcel

    January 19, 2007 @ 7:12 pm
  42. Comment by sesame:

    Hi, I was very happy with Rate My Stuff plugin but with the upgrade to 2.1 Ella, I don’t seem to be able to get it to work now. Any ideas how to get round this? I checked the Codex and it seems that this plugin should work, but it’s not doing anything for me.

    January 28, 2007 @ 3:31 am
  43. Comment by RAMI7250:

    hay, when im tring to activate the plugin im getting a warning:

    Warning: require_once() [function.require-once]: Unable to access /mounted-storage/home57b/sub001/sc34919-DAHD/www//wp-content/plugins/rate-my-stuff/core.php in /mounted-storage/home57b/sub001/sc34919-DAHD/www/wp-content/plugins/rate-my-stuff/rate-my-stuff.php on line 22

    how can i fix that?

    June 22, 2007 @ 6:19 am
  44. Comment by Matthew Loh:

    Hey! I love this plugin as it’s really simple and easy to use! See it in use in this post: Movie Review - The Fountain

    September 11, 2007 @ 11:27 am
  45. Comment by Frank Lucas:

    Your posts say the version for Rate My Stuff is 1.1 but the downloaded files say they are v1.0. Am I missing the link for v1.1?

    December 26, 2007 @ 11:48 am
  46. Comment by Clif:

    This is exactly what I needed for my wife’s new book review site (see link). I’m working on custom icons now to match the site theme. Great work!

    May 21, 2008 @ 12:56 am
  47. Comment by Monica:

    Hi! I must be doing something totally wrong, but I keep getting a fatal error when i try to activate the plugin!!

    I downloaded the zip, and uploaded it to the plugins folder.. but it’s not working.. *help* Thanks in advance!

    Warning: require_once(/home/.mariam/mbreports/mommybrainreports.com//wp-content/plugins/rate-my-stuff/core.php) [function.require-once]: failed to open stream: No such file or directory in /home/.mariam/mbreports/mommybrainreports.com/wp-content/plugins/rate-my-stuff/rate-my-stuff-custom-field.php on line 22

    Fatal error: require_once() [function.require]: Failed opening required ‘/home/.mariam/mbreports/mommybrainreports.com//wp-content/plugins/rate-my-stuff/core.php’ (include_path=’.:/usr/local/php5/lib/php:/usr/local/lib/php’) in /home/.mariam/mbreports/mommybrainreports.com/wp-content/plugins/rate-my-stuff/rate-my-stuff-custom-field.php on line 22

    July 8, 2008 @ 11:34 am
  48. Comment by Jason O'Brien:

    This plugin is old but still pretty neat. Could this be adapted to spit out a text number instead of images, in the format of 1/5, 3/5, etc.?

    November 5, 2008 @ 8:10 am
Write comment

Comment spam protected by SpamBam