In May 2006, Marc Hodges released his plugin Starred Review, which lets you post reviews easily. However, for some reason, the plugin didn’t work on PHP 4.x’s. Working with other people revealed that the problem was that the plugin could not get the directory names in the images directory. Another problem with the plugin was the (no offense!) messy stylesheet. With the help of other people and a little work, I could get it to work too.

To start with how to get the plugin to work, read below:

Our work is with the classes.php file. You can get the fixed classes.php file here, which i did in order to get the screenshots below. If it does not work for you, follow the steps below. For the stylesheet thing, look at the very below of this post. NOTE THAT saving Starred Review settings may result in broken star images, as it happened to me once. So, do all necessary settings before you go on with the fixes.

Now, what do we do? In learning a way to fix the plugin, I first looked at the generated page source, which looked like:

Starred Review - 1

As seen, the plugin fails to get directory list. So we make the plugin find the directory we want. You can see the line numbers below. These lines are at the very end of the file. We open the classes.php file and change the part accordingly:

Starred Review - 2

Starred Review gives you a bunch of color choices for the star images. Simply choose one according to your needs and type the directory name there. Be sure you do not forget the trailing slash or the ;.

If this does not work for you for some reason, simply look at your browser page source, and you’ll see the directory your Starred Review generates. Then, you’ll need to change it accordingly, which is easy.

Now, we will change all the $ext ‘s to .gif ‘s. Just below that line we’ve just fixed, you’ll see three $ext ‘s. Simply change them to .gif as in below:

Starred Review - 3

CSS: Your plugin should work now. But there are probably some stylesheet errors. One place to fix is on line 421, where we change starred-review-badge class to reviews, as in below:

Starred Review - 4

To display the month/category/rating titles as they should be, i change a line on 521. The change is in this file.

I simply removed the class, and added a br tag to achieve a new line before every title. It could also be done using stylesheets, but i chose to do it like this. Please post a comment on it on how to do it using stylesheet if you know any css. I also removed the ‘read’ thing from the badge function. Then, I changed the product links and review links, so that on the main page, when someone clicks on a review, it links to my review on my site. If I haven’t filled the review box for that specific review, it simply links to the main page (go check it out at my main page). Badge function allows you to view a number of most recent reviews, to use on your sidebar or main page. You can get this modification from this link.Simply search for badge in your classes.php file and change the section accordingly.

You can also download my Starred Review stylesheet here, and adapt to your needs. Open this file and add it to your theme stylesheet (simply copy and paste).

Edit: In order to integrate it my template file, I used the following code (do not forget to remove the space after < ‘s.

< ul class=\"reviews\">
< ?php starred_review(); ?>
< /ul>
I guess that’s all, and I guess it is all clear and easy. If you have any further questions, feel free to post a comment here, and do not forget to give your reviews page, so that i can have a look at it.

Tags:

This post has 16 comments.

  1. alper
    27 Jun 06
    16:29

    Please note that this will not fix the drop down image selection in the settings. who needs it anyway?

  2. hubs
    28 Jun 06
    1:48

    I have the plugin working but I can’t get it to look right. For some reason I am getting line breks with all the information on different lines instead of in a row. do you know what might be wrong?

    here is my reviews page:
    http://www.artifacting.com/blog/reviews/

  3. marc
    28 Jun 06
    2:56

    no offence taken, the style sheet was whipped up pretty quickly… glad you got it to work, I’ve been meaning to figure out why the drop down doesn’t work for a while, but the lack of free time has hampered this, well that and the fact that drop down works fine for me so I can’t replicate the error… I’ll have a bette rlook at this tutorial a little later, maybe I’ll make some of the changes to the program to get it to work

  4. alper
    28 Jun 06
    10:31

    < ul class=\"reviews\">
    < ?php starred_review(); ?>
    < /ul>

    this is how i integrated into my reviews template file.

  5. Rob
    29 Jun 06
    1:08

    Anyone know if it would be possible to display a particular review badge on a post page?

    It would be neat if this function could analyze the post’s URL and do a lookup in the Starred Review table to see if there’s a match. If so, display the stars automatically.

  6. alper
    29 Jun 06
    1:16

    i am no php expert. i can’t be counted as a newbie either.

    but i got a suggestion: you can use Rate My Stuff plugin to integrate stars. they are big but you can always replace them with starred review’s. i guess you’ll need to change/remove the image sizes too.

  7. Rob
    29 Jun 06
    1:44

    Ahh, cool. Thanks for the link! The only thing about Starred Review that I would miss is its database tables, and the ability to view in a list all the reviews that I’ve starred.

    But then again, either way I have to hand edit all 87 of my movie reviews, so why not use something like Rate My Stuff? Thanks again. :)

  8. hubs
    29 Jun 06
    23:19

    It is still not looking right on my reviews page. any suggestions?

    http://www.artifacting.com/blog/reviews/

  9. alper
    30 Jun 06
    11:15

    hubs, i guess you got it to work proper. now you need to make some changes to the css.

    you need to change the colors of the review titles and also the mouseover.

    as for the stars not showing right. i guess it is because your theme puts borders to images. i guess it will also be solved if you removed those borders, or write a new style for the star images.

    i looked at your site and the class to play is sr-star. just make one w/o borders or borders 0px, and i guess it will look nice.

    the one on my site uses theme defaults, so it looks fine on mine, but you gotta make your own. if you can’t figure it out, just let me know and we’ll see what we can do :)

  10. hubs
    05 Jul 06
    8:14

    even when i take the borders off, the stars still don’t show up. i think it has something to do with k2. the mouseover color i can change easy.

  11. alper
    05 Jul 06
    9:18

    what about doing this:

    reviews .sr-star {
    border: none !important;
    margin: 10px;
    }

    remove the margin line. if this doesn’t work, also remove:

    .reviews .sr-review .sr-review-rating {float:right;padding:10px;margin:10px;border:5px;}

    first border, then if it doesn’t work, margin too.

    i am not a css expert, so i can’t say ‘try this and it will do it’ all i can come up is advices. but i guess it should work.

  12. hubs
    06 Jul 06
    2:18

    yeah, still no luck, i guess i’ll just fool around with every attribute till i get it working. thanks for trying.

  13. Rouven
    22 Jul 06
    7:53

    i have exactly the same problem like hubs (using k2 theme as well)…

    i added

    to my review template but the changes i make to my stylesheet wont be applied to my review page.

    is there anything else i can do?! where should i look at?!

  14. nate
    15 Sep 06
    13:55

    Best I can tell, the offending CSS attribute that renders the stars invisible is the {float:right} value assigned to “sr-review-rating”.

    I worked around it by editing the classes.php file, and rearranging the order that the review values appear (from rating/category/title to category/title/rating). Just search for “sr-review-rating” (it only appears twice in classes.php, you want the second), and move that line and the two beneath it to the end of that indented list, but within the overarching div tag.

    After that, to reproduce the effect of the float tag, I chnaged the CSS line from “.reviews .sr-review .sr-review-rating {float:right;}” to “.reviews .sr-review .sr-review-rating {text-align: right}”. It seems to have worked for me, hopefully my instructions aren’t too fuzzy and it’ll work for you too.

  15. […] The plug-in (Starred Review) is user-created, and not without its flaws — it wasn’t until I found a hacked version somewhere else that it began to display the star images properly. That pretty much sums up the pros & cons of an active modding community, though. Even if someone else creates something buggy, someone else is free to pick it apart and make it work like a charm — like this quick fix for the last.fm plug-in I use. […]

  16. alper
    17 Sep 06
    15:46

    Thanks nate.

    I started to use WP-Ratings plugin (google it). On the main page I continue to use Starred Review, but the main list is WP-Ratings plugin.