Reviews – Easy Digital Downloads Development https://easydigitaldownloads.com/development Official development blog for Easy Digital Downloads Wed, 15 Dec 2021 21:31:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.2 https://easydigitaldownloads.com/development/files/2015/11/icon-256x256-150x150.png Reviews – Easy Digital Downloads Development https://easydigitaldownloads.com/development 32 32 Software Licensing v3.6.10 and Reviews v2.1.11 https://easydigitaldownloads.com/development/2020/04/13/software-licensing-v3-6-10-and-reviews-v2-1-11/ https://easydigitaldownloads.com/development/2020/04/13/software-licensing-v3-6-10-and-reviews-v2-1-11/#comments Mon, 13 Apr 2020 14:00:00 +0000 https://easydigitaldownloads.com/development/?p=897 This last week we released maintenance updates for two of our most popular extensions that each include a significant number of improvements.

Software Licensing version 3.6.10

Our focus for this update was to address a large number of lingering issues. We made twenty separate improvements to Software Licensing in version 3.6.10.

The complete list of items addressed:

  • Fix: When Apache forced trailing slashes, update packages could fail to be downloaded.
  • Fix: When upgrading a bundle, the child licenses may not have gotten their price IDs updated.
  • Fix: It was not possible to renew multiple licenses for the same product, at the same time.
  • Fix: When using bundle licenses with children, the license list table had some performance issues.
  • Fix: Child licenses could have a different activation limit than their parent.
  • Fix: License counts on the list table for license statuses could be incorrect when child licenses were used.
  • Fix: Some of the Readme information was not being parsed correctly after the latest parser update.
  • Fix: Searching for a child licenses could give incorrect results, or no results.
  • Fix: Updates could intermittently cause the ‘Too Many Redirects’ error.
  • Fix: Searching for partial license keys and email addresses could cause PHP notices and/or warnings.
  • Fix: When jQuery was being loaded in the footer, some JavaScript errors could occur when managing licenses on the front end.
  • Fix: Searching for a non-existent license key, returned all license keys in the list table.
  • Fix: Improved the reliability of the checks to make sure an update can be downloaded.
  • Fix: When using custom keys, it was possible to use a key length that exceeded the database column’s allowed length.
  • Sample Theme:
    • Fix: The sample theme was missing the theme_slug parameter from the API calls.
    • New: The sample theme now supports the item_id parameter.
  • Sample Plugin:
    • Fix: The “View Details” link on the plugin list was not always present.
    • Fix: Sample plugin did not define the EDD_SAMPLE_ITEM_NAME string.
  • New: Changelogs now support the “Read More” tag, to allow reducing changelog information stored in the get_version API calls.
  • Dev: The license list table columns are now filterable and sortable.

Reviews version 2.1.11

Like with Software Licensing, our focus for this update of the Reviews extension was fixing minor issues that have lingered for some time.

We fixed six bugs in version 2.1.11. Those bugs were:

  • Fix: Ensure custom code snippets cannot cause undefined index errors in the [downloads] shortcode
  • Fix: Enable review request emails to be sent when now is the selected time period
  • Fix: Compare version and only show admin notification for upgrade with outdated versions.
  • Fix: Verify that orders are complete or published before request review emails sent
  • Fix: Remove unused variable $post_id in class review widget
  • Fix: Use timestamp $now to ensure review request emails are being sent at correct time relative to store timezone.
]]>
https://easydigitaldownloads.com/development/2020/04/13/software-licensing-v3-6-10-and-reviews-v2-1-11/feed/ 3
Reviews version 2.0 – important changes and backwards compatibility https://easydigitaldownloads.com/development/2016/07/08/reviews-version-2-0-important-changes-and-backwards-compatibility/ https://easydigitaldownloads.com/development/2016/07/08/reviews-version-2-0-important-changes-and-backwards-compatibility/#comments Fri, 08 Jul 2016 20:30:59 +0000 https://easydigitaldownloads.com/development/?p=78 Reviews version 2.0 is close to being ready. It’s a major update to the way Reviews will function and we just want to go over the changes that will be coming to this release.

Database upgrades

If you have upgraded from a previous version of Reviews, you will see a notice in your WordPress Dashboard that the database needs upgrading. This upgrade goes through all the reviews stored in the database and changes the comment type and adds the metadata required for the new version to function correctly.

The changes to the database are:

  • Comment type is changed to edd_review
  • Add two new comment meta keys: edd_review_approved and edd_review_replyedd_review_approved just copies the value of the comment_approved field from the wp_comments table and edd_review_reply is only added for replies which were made to reviews. The plugin makes use of edd_review_approved for the comment status instead of the WordPress comment_approved field due to the way WordPress counts comments; it would cause the comment unread count to be incorrect.

When first updating to Reviews 2.0, the following admin notice will be displayed:

Screen Shot 2016-07-08 at 20.58.55

Following the link will begin the database upgrade and the upgrade routines described above wit

Moving away from the WordPress Comment Form

There are a huge number of improvements in 2.0 in the way reviews are handled. Up until now, we have been extending the WordPress comment_form by enabling support for comments on all downloads. In 2.0, we hook on to the the_content filter and display a custom form to submit reviews along with a custom Walker to display all the reviews.

The form displayed in Reviews 1.3.10 looks like this:

Screen Shot 2016-07-08 at 21.04.09

The new form coming to Reviews 2.0, looks like this:

Screen Shot 2016-07-08 at 21.04.26

As you can see, the standard WordPress comment form is displayed beneath the review submission form.  It should be noted that the comment form is only displayed if comments have been enabled on the Downloads post type.

There is very minimal styling applied to the form, in fact, only one CSS rule is applied which is:

.edd-reviews-form label {
display: inline-block;
width: 150px;
}

This rule just ensures that the labels and inputs line up.  Besides that, any global styling applied to input fields will be inherited from your theme.

In terms of the markup changes for the reviews form, this is an example of the markup for the review form:

https://gist.github.com/sunnyratilal/e7ccfbe2e83a4e322e2bf745a58d5ab2

This change not only makes the submission form more reliable, it also means that download products can now have reviews and comments enabled at the same time.

Please note: the markup has changed significantly from Reviews 1.x so themes that had specific styling for Reviews should be tested

All reviews now have a comment type of edd_review and are still stored in the wp_comments table.  They are filtered out from the WP_Comment_Query and other queries. If you currently query for reviews using get_comments, you need to remove the actions and filters which stop reviews and replies to reviews being queried. An example of querying reviews can be done as follows:

https://gist.github.com/sunnyratilal/7d814cd99d0ea006355d01afea1a4d8f

If you are doing custom querying of reviews, you must ensure to add the actions and filters after the get_comments call to ensure reviews are not tied in with comments.

Replies made to reviews have also been adjusted, they also follow the comment type of edd_review but have a meta key attached to them entitled edd_review_reply and it has a value of 1.

All reviews are displayed using a new Walker created: Walker_EDD_Review. The reviews are still displayed by making a call to wp_list_comments, the only thing different is the Walker which traverses over the reviews.

In the WordPress Dashboard, all reviews are now displayed on a new page which is located at Downloads > Reviews. No reviews will be displayed on the Comments admin page. The output of the review is controlled by the EDD_Reviews_List_Table class.

Improved API Output Data

Changes have been made to the data that is output when querying the reviews endpoint on the EDD API.

New keys that have been added:

  • parent: displays the ID of the parent review (only valid for replies)
  • type: displays the type of the review: whether it’s a review or a reply

The output has changed so that null is displayed if a review doesn’t have a title or a rating rather than just displaying a blank string. The same applies for votes: if no votes have been cast for a review, the votes key is simply set to null with no ‘yes’ and ‘no’ sub-keys.

Here is an example of the data output by the API in Reviews 2.0:

Screen Shot 2016-07-08 at 21.07.45

The first JSON element is of a reply to a review as can be distinguished by it having a value of reply for the type key. You can also see that the votes key has a value of null as replies do not have the voting feature.  The second JSON element has a type of review as well as a title key which has a value as well as having sub-keys for the votes key.

Integration with Frontend Submissions

Reviews now work alongside Frontend Submissions by allowing a much requested feature: Vendor Feedback.  All the code to integrates FES is stored under includes/class-edd-reviews-fes-integration.php.

A link is added to the Purchase History table to allow vendor feedback to be supplied. The labels can be changed using the templates and the Reviews settings under Downloads > Settings > Extensions > Reviews.

Screen Shot 2016-07-08 at 21.15.32

Upon installing Reviews, a new page is created called Vendor Feedback, this page has a shortcode which renders the feedback submission form.  The form looks like this:

Screen Shot 2016-07-08 at 21.16.45

All Vendor Feedback can be viewed from the FES Vendor Dashboard:

Screen Shot 2016-07-08 at 21.23.36

Administrators can view all Vendor Feedback by going to EDD FES > Vendor Feedback within the WordPress Admin interface.  It’s all displayed in a list table, as such:

Screen Shot 2016-07-08 at 21.14.58

Vendor Feedback is stored with an edd_vendor_feedback comment type in the comments table and, similar to reviews, is hidden from the WordPress Comments Query.  When querying vendor feedback, use a similar approach to above and just change the callback to array( edd_reviews()->fes, 'hide_feedback' ).

New Templating

Similar to Easy Digital Downloads, we have introduced a template system to allow easy modifications to certain elements of the plugins. These files are located in the templates folder of the plugin directory.

Template files bundled with the plugin are:

  • reviews-fes-vendor-feedback.php: This template is used to render all the Vendor Feedback submitted.  The output generated by this template is on the Vendor Feedback page of the FES Vendor Dashboard.
  • reviews-reply.php: This template builds the reply form which is displayed when replying to a review
  • reviews.php: This template is used for displaying the reviews and the review submission form
  • shortcode-vendor-feedback.php: This template handles the output of the [edd_vendor_feedback] shortcode and displays the form used to submit vendor feedback

All the templates bundled with the plugin can be edited by creating a file of the same name under the edd_templates folder of your active theme.  The file inside the edd_templates folder will override the file bundled in the plugin.

Updated Widgets and Shortcodes

The markup for the widgets and shortcodes has been altered to follow the same markup as a review displayed under downloads.

Featured Review Widget

https://gist.github.com/sunnyratilal/0f1067984f860c8906a712967edf89c1

The updated widget will be displayed like this:

Screen Shot 2016-07-08 at 21.12.07

Per Product Reviews Widget

https://gist.github.com/sunnyratilal/26edcf6f5edc9a9de95ede937b6354e2

The updated widget will be displayed like this:

Screen Shot 2016-07-08 at 21.13.06

Recent Reviews

https://gist.github.com/sunnyratilal/817912f590a395c278216369b8af23b7

The updated widget will be displayed exactly like the Per Product Review widget.

Review Shortcode

Note: previous custom styling for the review shortcode has been removed and has been replaced with a very simple CSS rule to add a border around the review with some padding and a margin.

https://gist.github.com/sunnyratilal/499ce552b314102b0fe3385a6dd74959

As you can see from the above snippets, the markup is now consistent across all widgets and shortcodes but this all means that custom styling previous applied to the widgets and shortcode will break and again, as aforementioned, themes will need to be tested.

Other Notable Fixes/Changes

  • TinyMCE widget to embed reviews into posts has been rewritten and redesigned to work better with the WordPress Editor
  • HTML 5 microdata has been fixed and validated
  • Markup to display the star rating for each rating has been changed from using images to using WordPress Dashicons.
]]>
https://easydigitaldownloads.com/development/2016/07/08/reviews-version-2-0-important-changes-and-backwards-compatibility/feed/ 2