Site Reviews - Version 5.17.7

Version Description

(2021-11-23) =

  • Added the "site-reviews/review/request" hook
Download this release

Release Info

Developer geminilabs
Plugin Icon 128x128 Site Reviews
Version 5.17.7
Comparing to
See all releases

Code changes from version 5.17.6 to 5.17.7

languages/site-reviews-en_US.po CHANGED
@@ -88,11 +88,11 @@ msgstr "This review is based on my own experience and is my genuine opinion."
88
  msgid "Show more"
89
  msgstr "Show more"
90
 
91
- #: plugin/Commands/CreateReview.php:163
92
  msgid "Your review has been submitted!"
93
  msgstr "Your review has been submitted!"
94
 
95
- #: plugin/Commands/CreateReview.php:167, views/pages/documentation/support/common-problems-and-solutions.php:75
96
  msgid ""
97
  "Your review could not be submitted and the error has been logged. Please "
98
  "notify the site administrator."
88
  msgid "Show more"
89
  msgstr "Show more"
90
 
91
+ #: plugin/Commands/CreateReview.php:164
92
  msgid "Your review has been submitted!"
93
  msgstr "Your review has been submitted!"
94
 
95
+ #: plugin/Commands/CreateReview.php:168, views/pages/documentation/support/common-problems-and-solutions.php:75
96
  msgid ""
97
  "Your review could not be submitted and the error has been logged. Please "
98
  "notify the site administrator."
languages/site-reviews.pot CHANGED
@@ -1311,11 +1311,11 @@ msgstr ""
1311
  msgid "Show more"
1312
  msgstr ""
1313
 
1314
- #: plugin/Commands/CreateReview.php:163
1315
  msgid "Your review has been submitted!"
1316
  msgstr ""
1317
 
1318
- #: plugin/Commands/CreateReview.php:167, views/pages/documentation/support/common-problems-and-solutions.php:75
1319
  msgid "Your review could not be submitted and the error has been logged. Please notify the site administrator."
1320
  msgstr ""
1321
 
1311
  msgid "Show more"
1312
  msgstr ""
1313
 
1314
+ #: plugin/Commands/CreateReview.php:164
1315
  msgid "Your review has been submitted!"
1316
  msgstr ""
1317
 
1318
+ #: plugin/Commands/CreateReview.php:168, views/pages/documentation/support/common-problems-and-solutions.php:75
1319
  msgid "Your review could not be submitted and the error has been logged. Please notify the site administrator."
1320
  msgstr ""
1321
 
plugin/Commands/CreateReview.php CHANGED
@@ -53,6 +53,7 @@ class CreateReview implements Contract
53
  if (!defined('WP_IMPORTING') || empty($request->ip_address)) {
54
  $request->set('ip_address', Helper::getIpAddress()); // required for Akismet and Blacklist validation
55
  }
 
56
  $this->request = $request;
57
  $this->sanitize();
58
  }
53
  if (!defined('WP_IMPORTING') || empty($request->ip_address)) {
54
  $request->set('ip_address', Helper::getIpAddress()); // required for Akismet and Blacklist validation
55
  }
56
+ glsr()->action('review/request', $request);
57
  $this->request = $request;
58
  $this->sanitize();
59
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: reviews, ratings, testimonials, woocommerce, product reviews, business rev
5
  Tested up to: 5.8
6
  Requires at least: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 5.17.6
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -140,6 +140,10 @@ All documentation can be found in the "Help" page of the plugin. If your questio
140
 
141
  ## Changelog
142
 
 
 
 
 
143
  = 5.17.6 (2021-11-17) =
144
 
145
  - Fixed the Approve/Unapprove links on the All Reviews page
5
  Tested up to: 5.8
6
  Requires at least: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 5.17.7
9
  License: GPLv3
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
140
 
141
  ## Changelog
142
 
143
+ = 5.17.7 (2021-11-23) =
144
+
145
+ - Added the "site-reviews/review/request" hook
146
+
147
  = 5.17.6 (2021-11-17) =
148
 
149
  - Fixed the Approve/Unapprove links on the All Reviews page
site-reviews.php CHANGED
@@ -7,7 +7,7 @@
7
  * Plugin Name: Site Reviews
8
  * Plugin URI: https://wordpress.org/plugins/site-reviews
9
  * Description: Receive and display reviews on your website
10
- * Version: 5.17.6
11
  * Author: Paul Ryley
12
  * Author URI: https://geminilabs.io
13
  * License: GPL2
7
  * Plugin Name: Site Reviews
8
  * Plugin URI: https://wordpress.org/plugins/site-reviews
9
  * Description: Receive and display reviews on your website
10
+ * Version: 5.17.7
11
  * Author: Paul Ryley
12
  * Author URI: https://geminilabs.io
13
  * License: GPL2
views/pages/documentation/hooks.php CHANGED
@@ -10,6 +10,7 @@ $sections = [
10
  trailingslashit(__DIR__).'hooks/do-something-after-submission.php',
11
  trailingslashit(__DIR__).'hooks/filter-schema.php',
12
  trailingslashit(__DIR__).'hooks/filter-submitted-review-values.php',
 
13
  ];
14
  $filename = pathinfo(__FILE__, PATHINFO_FILENAME);
15
  $sections = glsr()->filterArrayUnique('documentation/'.$filename, $sections);
10
  trailingslashit(__DIR__).'hooks/do-something-after-submission.php',
11
  trailingslashit(__DIR__).'hooks/filter-schema.php',
12
  trailingslashit(__DIR__).'hooks/filter-submitted-review-values.php',
13
+ trailingslashit(__DIR__).'hooks/modify-request.php',
14
  ];
15
  $filename = pathinfo(__FILE__, PATHINFO_FILENAME);
16
  $sections = glsr()->filterArrayUnique('documentation/'.$filename, $sections);
views/pages/documentation/hooks/filter-submitted-review-values.php CHANGED
@@ -7,7 +7,7 @@
7
  </button>
8
  </h3>
9
  <div id="hooks-filter-submitted-review-values" class="inside">
10
- <p>Use this hook if you want to modify the values of a submitted review before it is created.</p>
11
  <pre><code class="language-php">/**
12
  * Modifies the review values before they are saved
13
  * Paste this in your active theme's functions.php file.
7
  </button>
8
  </h3>
9
  <div id="hooks-filter-submitted-review-values" class="inside">
10
+ <p>Use this hook if you want to modify the values of a submitted review before it is created. If you would like to directly modify the Request of a submitted review before the values are sanitised, use the <code><a data-expand="#hooks-modify-review-request" href="<?= glsr_admin_url('documentation', 'hooks'); ?>">site-reviews/review/request</a></code> instead.</p>
11
  <pre><code class="language-php">/**
12
  * Modifies the review values before they are saved
13
  * Paste this in your active theme's functions.php file.
views/pages/documentation/hooks/modify-request.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="glsr-card postbox">
2
+ <h3 class="glsr-card-heading">
3
+ <button type="button" class="glsr-accordion-trigger" aria-expanded="false" aria-controls="hooks-modify-review-request">
4
+ <span class="title">Modify the submitted review request</span>
5
+ <span class="badge code">site-reviews/review/request</span>
6
+ <span class="icon"></span>
7
+ </button>
8
+ </h3>
9
+ <div id="hooks-modify-review-request" class="inside">
10
+ <p>Use this hook if you want to modify the request of a submitted review. This hook is similar to the <code><a data-expand="#hooks-filter-submitted-review-values" href="<?= glsr_admin_url('documentation', 'hooks'); ?>">site-reviews/create/review-values</a></code> hook, except that it allows you to directly modify the raw Request object before the values are sanitised.</p>
11
+ <pre><code class="language-php">/**
12
+ * Paste this in your active theme's functions.php file.
13
+ * @param \GeminiLabs\SiteReviews\Request $request
14
+ * @return void
15
+ */
16
+ add_action('site-reviews/review/request', function ($request) {
17
+ // modify the $request object here, you do this by using the "get" and "set" methods of the object.
18
+ // For example:
19
+ $assignedPosts = $request->get('assigned_posts'); // this is a comma-separated string, not an array!
20
+ if ('13' === $assignedPosts) {
21
+ $request->set('assigned_posts', '13,14,15');
22
+ }
23
+ });</code></pre>
24
+ </div>
25
+ </div>