GD Star Rating 1.5.1
And now for something completely different. New version of GD Star Rating. I have finally completed very difficult task on optimizing the plugin and number of SQL queries executed. I wanted to include this in 1.5.0, but I needed few more days.
Depending on the theme, number of loops and other things, during the forming of the page, plugin makes a number of calls to the database. But that was not always done the best possible way. In many cases there were duplicate calls for getting the same templates, same check for the recorded votes and few more things that needed to be dealt with. Last 2 weeks I have been testing all that, and I have found all the problems and I decided that best way to solve them is to use two methods: cache and prefetch.
Cache is used for templates, posts, comments and log checks. Prefetch is used for posts, comments and logs. So, if you have a front page with 10 posts, and you show standard rating for each post there, typically you need 4 queries per post: 2 for template, one to get rating data and one to check log for duplicated vote. For 10 posts that’s 40 queries on top of only 20 that WP needs for the whole page. Comments are in the similar state, but usually you can have 30-40 comments per page. Since (by default) all posts will use same template, instead for 20 queries for templates with need only 2, we save them to cache and use from there. And that cuts queries in half. Prefetch is done once the loop starts, and in one query we get data for all 10 posts at once, and in second query all 10 logs for these posts, cutting number of queries from starting 40 to 4 for the whole front page, making less then half a query per post. And saving over 90% on database access.
On single post you still need to execute all 4 queries, so nothing is gained, but single post has comments, and again with them we get 90% savings. When it comes to multi ratings they need an extra query for multi elements, but I have cleaned up some of the code, removing number of queries used for multi ratings. When I complete tests, in a typical situation, 1.5.1 executes up to 70% (yes, seventy percents) less queries than 1.5.0 and previous versions. Also, having to execute less SQL queries, this change reduced used memory for about 1MB.
As an interesting comparison, GD Star Rating now needs less queries for 10 posts than WP-PostRatings plugin. A lot of people didn’t want to replace WP-PostRatings with GD Star Rating because it was simpler, and that also caused that plugin to need less queries per page. Now that’s no longer case, and in most cases with all the features GD Star Rating has, it now needs very few queries to work.
If you use multiple loops and with them you show ratings in different places, than savings in your case can be even bigger. Anyway, there is not much to say, you simply need to upgrade to 1.5.1. It is very, very fast, with minimal impact to page loading performance and due to the all previous bug fixes during 1.4.x release history, very stable. But, if you find any problem you can safely go back to 1.5.0, and please report any problem you find.
loading...






















Hope this will work for me, man. And yeah, first Post! :p
loading...
Unfortunally it does not work. The Problem:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/kunden/webs/mircdevil/koelnblogger/wp-content/plugins/gd-star-rating/code/t2/render.php on line 495
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/kunden/webs/mircdevil/koelnblogger/wp-content/plugins/gd-star-rating/code/t2/render.php on line 500
Any Ideas? Wordpress MU with Buddypress trying to install the Plugin in the Mainblog.
loading...
WPMU/BuddyPress are not supported at the moment, and I can’t help you with this problem right now. I know that some people managed to use it, but I myself haven’t tried it once with WPMU. If you check the latest development roadmap you can see that I plan to add full WPMU support in the next few months.
loading...
I can’t wait to try this out. Thank you for your hard work.
loading...
Oh man, that’s … yeah, however, Thanks anyway. But see? This people did manage it, and they don’t tell us how… How can some be so selfish?
Okay, as I said, thanks anyway.
loading...
As far as I know making plugin work on WPMU requires some small changes to plugin, but I don’t know exactly what. I will start to work on that very soon, but I am guessing that it will take some time do solve all the problems. Good news is that WPMU will soon be gone and merged with regular WP, and that will make things much easier to handle.
loading...
WOW excellent job! You weren’t kidding that it’s easy to integrate. I will be passing this plugin on to others.
Thank you again for all your hard work.
Even the user guide is easy to follow.
loading...
Really quick question…I added the ratings to my post and i can hover over them and see them add/subtract stars, but when I click on it it won’t register…
loading...
That’s most likely JavaScript error or AJAX cross domain request problem.
loading...
Here are results from testing plugin on my Dev4Press website:
Single post with 18 comments, using standard comment rating. Without GD Star Rating 135 queries executed. With GD Star Rating 1.5.0, number of queries was 207. And now with GD Star Rating 1.5.1 only 142 queries are executed. So, initially plugin added 72 queries, with new version needs only 7, and that’s 90% reduction.
If you have post with 100 comments, with old version of the plugin you would need some 450 additional queries, with new version, again only 7. All data is prefetched and cached no matter how many comments are to be rendered.
loading...
I’m running the plugin on MU and it works fine!
loading...
An error appeared when I upgrade :Warning: Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/veryhardplayer/www/wp-content/plugins/gd-star-rating/gd-star-rating.php on line 1587. what can be? help. pls
loading...
After each update you need to review all the settings and save them again to ensure that everything is fine.
loading...
Hi Milan
- Deleting a comment still doesn’t delete the corresponding star rating.
- Secondly, in your category management post screenshot – below the table there is articles setting pane and below that comment setting pane. But for me it just shows article setting pane. (In settings – comment rating is unchecked but comment review rating is checked)so am not sure if the behavior is correct
loading...
I am getting this shown on my post when i upgraded to 1.5.1
Please help:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') group by p.comment_ID' at line 1]
select p.comment_ID as ID, count(l.record_id) as counter from wp_comments p left join wp_gdsr_moderate l on l.id = p.comment_ID and l.vote_type = ‘comment’ and l.user_id = 1 where p.comment_ID in () group by p.comment_ID
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') group by p.comment_ID' at line 1]
select p.comment_ID as ID, count(l.record_id) as counter from wp_comments p left join wp_gdsr_votes_log l on l.id = p.comment_ID and l.vote_type = ‘comment’ and l.user_id = 1 where p.comment_ID in () group by p.comment_ID
loading...
Hi,
there seems to be an incompatibility with IE 8. Rating doesn’t work in standard neither in “compatibility”-Mode on my blog. With Firefox, everything works fine.
loading...
In most cases everything is fine in all browsers. Your problem is most likely caused by your theme. No matter how hard I try to make CSS isolated, there is always something in the theme CSS that can interfear.
loading...
All error reports will be checked, and I will fix these errors ASAP. New version either tonight or tomorrow.
loading...
Thx for your immediate answer!! Great plugin and great support, too!! So I will check theme-issues.
loading...
Im going to complain about this again, because I think your answer isn’t reasonable.
If a post has a review, I don’t see any reason why when you edit the post the code can’t be smart enough to say “hey, this has a restaurant review, use that template instead of the last one!”
I understand that you can’t know what a new post is, or why you display the “last” review template if the current post has no review, but its easy enough to see if a post has an existing entry. This is what happens:
I create a review with the “hotel” template.
I edit an existing restaurant review. It displays the hotel template.
I then have to change the dropdown, and publish again to gain access to the rest review.
If I only edit the text and fail to reset the template, I get a blank hotel review in the database.
Its just wrong.
loading...
As I said before, this is very complicated to be generalized like that, and in most cases is not as simple as you say it is.
I know that it can be done better, and at one point all that will be replaced with ajax but that will require some 2-3 days of my time, a time I simply don’t have. And since you are so far the only one who had problems with that, this is not high on my priorities list.
loading...
Do we know how do we revert back to the older version? which files must I keep or replace?
loading...
The problem you found is solved. New version will be released later tonight.
You can always get older versions from WordPress.org archives or this website (I keep only some version here), and delete plugin from plugins folder, and unpack the version you want.
loading...
by doing that will it cause my data (previous rating) to be gone?
loading...
Nothing will be lost.
loading...
Thanks for the prompt update. Just wondering where are the ratings stored? which file?
Since the new version going to be out tonight i think i will wait for it.
loading...
Ratings are in database.
loading...
In GD Star Rating options –> Multi i have this error after creation of a multi’s vote:
Warning: cannot yet handle MBCS in html_entity_decode()! in mysite/wordpress/wp-content/plugins/gd-star-rating/options/multis/editor.php on line 35
The multi funcion works but i can’t modify name and others values after creation.
Anyway, amazing plugin.
loading...
Not a bug. This is the error caused by PHP and use of unsupported characters. As far as I know this is PHP4 only problem.
loading...
Hey MillaN,
Just wanted to post a great big THANK YOU>!
I just updated to the latest version, and everything works fine. The export function performs exactly as required!
It’s a great addition to our awards blog, just the thing we needed to collect and track votes, and we might even use it on the comments section.
We love blogging..and this is a tremendous (AND FREE) tool for all bloggers!
THANK YOU THANK YOU!
Tim
Awarding the best Blogs online
Blognetawards.com
loading...
ok, so i tried installing this thru WP plugin manager but just hung there upon extract, so i manually dl’d and installed, but im getting a “500 Internal server error” with no other details except “…try again later” so i tried deleting and installing 1.4.7- no luck there either. on top of that the “500 error” message now appears in a new, blank page instead of within the plugin manager (im using WP2.8) as it did upon first install (of 1.5.1).
also, when i hit the “edit” link in the plugin manager for the gd-star-rating, nothing happens; the link seems to stop halfway through and leaves a half blank page instead of the plugin’s code.
loading...
Again, try to increase memory. The things you describe look like PHP run out of memory. WP 2.8 require more memory than 2.7.
loading...
im seeing 40M as my current limit- is that really not enough?
http://www.edgeptstudio.com/test.php
loading...
WP 2.7.1 worked just fine with 32M, but I now use 48M just in case. Waiting for 2.8.1 that should fix that,
loading...
strange- i SWEAR it was at 40M a moment ago… :/
loading...
i think it was actually cuz the host (1and1) was runnin PHP 4- set it to run in 5 and now evrything seems aight
loading...
Hi, MillaN
I have a quick question :
How can I get the Stars and Rating text in the same line (rating text after Stars)
Thanks
loading...
Thank you SO VERY MUCH for this wonderful plugin. I know you’ve taken a lot of time to develop it and I wanted to let you know how much your effort is valued.
loading...
Any chance the Multi Ratings will be able to be automatically be inserted in all posts? Like the standard ratings? I believe this is not currently possible is that right?
and also an option to auto insert into comments?
loading...
Well it is possible. Edit your multi set and set where you want it auto inserted. You can auto insert for all posts or on category basis. Multi ratings are only for posts not comments. Adding to comment form is possible, but multi rating added that way will be for the post, it’s for reviewing of the post contents. And even that integration must be done manually (WordPress restriction).
loading...
Thanks for the quick response, how does one edit the multiset for auto insert in all posts?
loading...