Commit Graph

42 Commits

Author SHA1 Message Date
Chase Wiseman 51b5d11b97 Prevent average product rating meta from being set for other post types 2016-09-08 09:36:56 -07:00
Mike Jolley eab72bd48e Sync rating after clear_transients so meta exists
#11711
2016-08-18 11:10:16 +01:00
Rodrigo Primo 7318235f58 Cache the result of WC_Comments::wp_count_comments() in a transient
The query to count comments inside WC_Comments::wp_count_comments() is super slow when the site has a significant number of comments (for example, this query takes about 5s to run on WooCommerce.com with 70k comments) and this is a problem specially considering that this method is called on every admin page.

This commit changes WC_Comments::wp_count_comments() to store the comments count in a transient. With this change, the method will run the query to count comments only if the number of comments or their statuses had changed. Before this commit, WC_Comments::wp_count_comments() would run the database query every time a admin page was requested.
2016-07-15 15:01:21 +02:00
Mike Jolley adf0c2152e Fix - Don't sync ratings right away; meta won't exist in some cases. 2016-06-28 15:24:37 +01:00
Mike Jolley 6c20051025 Tweak comment exclusion join to avoid conflicts
Closes #10989 @claudiosmweb
2016-05-25 15:43:18 +01:00
Claudio Sanches 19019f75ca [2.5] Stop to remove the 'all' from wp_count_comments(), closes #10441 2016-02-29 13:35:24 -03:00
Mike Jolley 1d5349bc83 Keep rating meta synced for filtering 2016-02-09 20:53:18 +00:00
Fredrik Forsmo 9a9aaff342 Improve docblock comments WC_Comments
* Added missing param tags to `comment_moderation_recipients`
2016-01-06 15:49:24 +01:00
Mike Jolley 3ceed757bd Store rating and reviews in postmeta rather than transients
These don’t change often, and as long as we listen for comment count
update events will be kept in sync.
2015-11-13 20:41:20 +00:00
Nicola Mustone c9da4f928a check if ABSPATH is defined 2015-11-06 10:22:19 +01:00
Claudio Sanches 5893875b0c Removed period for file headers 2015-11-03 11:53:50 -02:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Jeff Stieler e9bfa2553c Return verification status in WC_Comments::add_comment_purchase_verification(). 2015-10-20 22:03:30 -06:00
Jeff Stieler 71cfde70c9 Mark a comment as “verified” if the customer leaving it has purchased the product they’re reviewing. 2015-10-20 22:03:29 -06:00
Claudio Sanches b9442f2ffa [2.3] Check if rating is enabled before check if rating is required to a review, closes #8281 2015-06-03 16:57:36 -03:00
Mike Jolley b8bcd24edd [2.3] Combine transients for get_rating_count
@claudiosmweb
2015-05-25 02:00:20 +01:00
Mike Jolley 4311055aeb Send review moderation email to admin
Closes #8132
2015-05-13 15:47:32 +01:00
Mike Jolley b0e0bdcfad Do not enforce rating in admin
Closes #7679
2015-03-10 11:01:59 +00:00
Mike Jolley 30abed2f9e Merge pull request #7375 from tamarazuk/rating-count-fix
Fix average product rating when ratings are not required
2015-02-12 00:04:26 +00:00
Mike Jolley 1f9b9c0ae0 When ratings are required for reviews, ensure validation is performed if the rating element is removed from DOM.
Closes #7371
2015-02-11 23:06:18 +00:00
Tamara Zuk 7eaae2d561 Fix average product rating when ratings are not required
If ratings are not required, the total rating count was counting all
reviews which skewed the average rating. In other words, reviews with
no rating were counted as a “zero” rating in the average rating
calculation. This bug was introduced in
83a457b29c which provided a fix for #6839.

This change introduces a new product method `get_review_count()` which
can be used to accurately calculate the total number of reviews for a
product. Some instances of `get_rating_count()` were replaced with
`get_review_count()` where appropriate. Additionally, the
`single-product/rating.php` template was adjusted to display the
correct number of customer reviews and ratings in rich snippets. I’ve
also included the `bestRating` rich snippet detailed
[here](http://schema.org/AggregateRating). The version number was
adjusted to 2.3.2 on that template as I think this is a larger change.
2015-02-11 17:55:16 -05:00
shivapoudel cb57c7e709 Docblocks cleanup for WC_Comments 2015-02-04 21:44:42 +05:45
Claudio Sanches a723cfb256 Fix the cleanup of reviews transients, closes #7214
@mikejolley

Please enter the commit message for your changes. Lines starting
2015-01-28 15:09:37 -02:00
Max Rice 96bc2ff25e Support avatars for the `review` comment type 2015-01-20 00:26:33 -05:00
Illimar Tambek 386011ffae Allow getting rating count for a specific rating number 2014-09-17 11:03:10 +03:00
claudiosmweb 78c7fefe3e fixed some docblocks 2014-09-02 16:50:19 -03:00
claudiosmweb 6e21079d76 moved exclude order notes from wp_count_comments to class-wc-comments.php 2014-08-12 12:13:29 -03:00
claudiosmweb eb8d99f4ea fixed some coding standards in includes/class-wc-comments.php 2014-08-12 12:07:23 -03:00
claudiosmweb 507a2038e8 fixed comments query 2014-08-12 12:05:09 -03:00
Max Rice 0fd7e3376d Hide webhook comments
Part of #5564
2014-07-30 16:23:41 -04:00
Mike Jolley 755001f19b Use order types where required 2014-07-11 12:43:42 +01:00
Mike Jolley d1dbe4492e Clear comment transients only on wp_update_comment_count
Does not need to be flushed when editing a product. Part of #5777
2014-07-03 12:59:57 +01:00
Coen Jacobs 3ad8935b20 Removed ununsed global variables in local scopes 2014-06-08 22:33:11 +02:00
Mike Jolley e198ee517a Made stateless classes static to allow unhooking of hooks
Closes #5151
2014-05-28 14:52:50 +01:00
Mike Jolley af70da5ebb Remove nonce from comment form to prevent issues with caching 2014-04-08 09:37:01 +01:00
Mike Jolley cc7325e869 Ensure there is a join Fixes #4390 2013-12-24 13:31:37 +00:00
Mike Jolley 51ba9c393f WC globals 2013-11-25 14:01:38 +00:00
Max Rice a909140cb1 Fix typo 2013-11-10 14:01:12 -05:00
Max Rice 2bb83bb1d8 Make WC_Comments::exclude_order_comments static
The WC_Comments class is an orphaned global so there's no way for other
code to access it in order to remove the `comment_clauses` filter. This
changes the add_filter and associated method to static so other code
can properly remove the filter for querying order notes
2013-11-04 01:34:21 -05:00
Scott Basgaard ea03af2ee4 woocommerce_exclude_order_comments() is now exclude_order_comments() 2013-10-26 17:30:43 +02:00
Mike Jolley a5d71a8113 Fix for submitting comments 2013-09-24 11:48:42 +01:00
Mike Jolley 57157db9bf Function refactoring. 2013-08-09 17:11:21 +01:00