Version Description
(2021-06-12) =
- Fixed the "respond_to_*" capabilities, users can now respond to reviews if they are the author of one of the assigned posts
Download this release
Release Info
Developer | geminilabs |
Plugin | Site Reviews |
Version | 5.12.1 |
Comparing to | |
See all releases |
Code changes from version 5.12.0 to 5.12.1
- languages/site-reviews-en_US.po +5 -5
- languages/site-reviews.pot +5 -5
- plugin/Controllers/AdminController.php +18 -11
- plugin/Role.php +2 -0
- readme.txt +6 -2
- site-reviews.php +1 -1
languages/site-reviews-en_US.po
CHANGED
@@ -1683,29 +1683,29 @@ msgctxt "admin-text"
|
|
1683 |
msgid "Edit"
|
1684 |
msgstr "Edit"
|
1685 |
|
1686 |
-
#: plugin/Controllers/AdminController.php:
|
1687 |
msgctxt "admin-text"
|
1688 |
msgid "%s Review"
|
1689 |
msgid_plural "%s Reviews"
|
1690 |
msgstr[0] "%s Review"
|
1691 |
msgstr[1] "%s Reviews"
|
1692 |
|
1693 |
-
#: plugin/Controllers/AdminController.php:
|
1694 |
msgctxt "admin-text"
|
1695 |
msgid "Recent Reviews"
|
1696 |
msgstr "Recent Reviews"
|
1697 |
|
1698 |
-
#: plugin/Controllers/AdminController.php:
|
1699 |
msgctxt "admin-text"
|
1700 |
msgid "Submit a Review"
|
1701 |
msgstr "Submit a Review"
|
1702 |
|
1703 |
-
#: plugin/Controllers/AdminController.php:
|
1704 |
msgctxt "admin-text"
|
1705 |
msgid "Summary of Reviews"
|
1706 |
msgstr "Summary of Reviews"
|
1707 |
|
1708 |
-
#: plugin/Controllers/AdminController.php:
|
1709 |
msgctxt "admin-text"
|
1710 |
msgid "Nothing found."
|
1711 |
msgstr "Nothing found."
|
1683 |
msgid "Edit"
|
1684 |
msgstr "Edit"
|
1685 |
|
1686 |
+
#: plugin/Controllers/AdminController.php:107
|
1687 |
msgctxt "admin-text"
|
1688 |
msgid "%s Review"
|
1689 |
msgid_plural "%s Reviews"
|
1690 |
msgstr[0] "%s Review"
|
1691 |
msgstr[1] "%s Reviews"
|
1692 |
|
1693 |
+
#: plugin/Controllers/AdminController.php:188, plugin/Widgets/SiteReviewsWidget.php:113
|
1694 |
msgctxt "admin-text"
|
1695 |
msgid "Recent Reviews"
|
1696 |
msgstr "Recent Reviews"
|
1697 |
|
1698 |
+
#: plugin/Controllers/AdminController.php:189, plugin/Widgets/SiteReviewsFormWidget.php:78, plugin/Integrations/Elementor/ElementorFormWidget.php:21
|
1699 |
msgctxt "admin-text"
|
1700 |
msgid "Submit a Review"
|
1701 |
msgstr "Submit a Review"
|
1702 |
|
1703 |
+
#: plugin/Controllers/AdminController.php:190, plugin/Widgets/SiteReviewsSummaryWidget.php:81
|
1704 |
msgctxt "admin-text"
|
1705 |
msgid "Summary of Reviews"
|
1706 |
msgstr "Summary of Reviews"
|
1707 |
|
1708 |
+
#: plugin/Controllers/AdminController.php:225, plugin/Controllers/AdminController.php:245, plugin/Controllers/AdminController.php:258
|
1709 |
msgctxt "admin-text"
|
1710 |
msgid "Nothing found."
|
1711 |
msgstr "Nothing found."
|
languages/site-reviews.pot
CHANGED
@@ -1312,29 +1312,29 @@ msgctxt "admin-text"
|
|
1312 |
msgid "Edit"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
-
#: plugin/Controllers/AdminController.php:
|
1316 |
msgctxt "admin-text"
|
1317 |
msgid "%s Review"
|
1318 |
msgid_plural "%s Reviews"
|
1319 |
msgstr[0] ""
|
1320 |
msgstr[1] ""
|
1321 |
|
1322 |
-
#: plugin/Controllers/AdminController.php:
|
1323 |
msgctxt "admin-text"
|
1324 |
msgid "Recent Reviews"
|
1325 |
msgstr ""
|
1326 |
|
1327 |
-
#: plugin/Controllers/AdminController.php:
|
1328 |
msgctxt "admin-text"
|
1329 |
msgid "Submit a Review"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
-
#: plugin/Controllers/AdminController.php:
|
1333 |
msgctxt "admin-text"
|
1334 |
msgid "Summary of Reviews"
|
1335 |
msgstr ""
|
1336 |
|
1337 |
-
#: plugin/Controllers/AdminController.php:
|
1338 |
msgctxt "admin-text"
|
1339 |
msgid "Nothing found."
|
1340 |
msgstr ""
|
1312 |
msgid "Edit"
|
1313 |
msgstr ""
|
1314 |
|
1315 |
+
#: plugin/Controllers/AdminController.php:107
|
1316 |
msgctxt "admin-text"
|
1317 |
msgid "%s Review"
|
1318 |
msgid_plural "%s Reviews"
|
1319 |
msgstr[0] ""
|
1320 |
msgstr[1] ""
|
1321 |
|
1322 |
+
#: plugin/Controllers/AdminController.php:188, plugin/Widgets/SiteReviewsWidget.php:113
|
1323 |
msgctxt "admin-text"
|
1324 |
msgid "Recent Reviews"
|
1325 |
msgstr ""
|
1326 |
|
1327 |
+
#: plugin/Controllers/AdminController.php:189, plugin/Widgets/SiteReviewsFormWidget.php:78, plugin/Integrations/Elementor/ElementorFormWidget.php:21
|
1328 |
msgctxt "admin-text"
|
1329 |
msgid "Submit a Review"
|
1330 |
msgstr ""
|
1331 |
|
1332 |
+
#: plugin/Controllers/AdminController.php:190, plugin/Widgets/SiteReviewsSummaryWidget.php:81
|
1333 |
msgctxt "admin-text"
|
1334 |
msgid "Summary of Reviews"
|
1335 |
msgstr ""
|
1336 |
|
1337 |
+
#: plugin/Controllers/AdminController.php:225, plugin/Controllers/AdminController.php:245, plugin/Controllers/AdminController.php:258
|
1338 |
msgctxt "admin-text"
|
1339 |
msgid "Nothing found."
|
1340 |
msgstr ""
|
plugin/Controllers/AdminController.php
CHANGED
@@ -69,21 +69,28 @@ class AdminController extends Controller
|
|
69 |
*/
|
70 |
public function filterCapabilities($capabilities, $capability, $userId, $args)
|
71 |
{
|
72 |
-
if (
|
73 |
return $capabilities;
|
74 |
}
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
}
|
86 |
-
|
|
|
|
|
|
|
87 |
}
|
88 |
|
89 |
/**
|
69 |
*/
|
70 |
public function filterCapabilities($capabilities, $capability, $userId, $args)
|
71 |
{
|
72 |
+
if ('respond_to_'.glsr()->post_type !== $capability) {
|
73 |
return $capabilities;
|
74 |
}
|
75 |
+
$review = glsr_get_review(Arr::get($args, 0));
|
76 |
+
if (!$review->isValid()) {
|
77 |
+
return ['do_not_allow'];
|
78 |
+
}
|
79 |
+
$capabilities = [];
|
80 |
+
$respondToReviews = glsr(Role::class)->capability('respond_to_posts');
|
81 |
+
if ($userId == $review->author_id) {
|
82 |
+
$capabilities[] = $respondToReviews; // they are the author of the review
|
83 |
+
}
|
84 |
+
foreach ($review->assignedPosts() as $assignedPost) {
|
85 |
+
if ($userId == $assignedPost->post_author) {
|
86 |
+
$capabilities[] = $respondToReviews; // they are the author of the post that the review is assigned to
|
87 |
+
break;
|
88 |
}
|
89 |
}
|
90 |
+
if (!in_array($respondToReviews, $capabilities)) {
|
91 |
+
$capabilities[] = glsr(Role::class)->capability('respond_to_others_posts');
|
92 |
+
}
|
93 |
+
return array_unique($capabilities);
|
94 |
}
|
95 |
|
96 |
/**
|
plugin/Role.php
CHANGED
@@ -52,7 +52,9 @@ class Role
|
|
52 |
'publish_posts',
|
53 |
'read_post',
|
54 |
'read_private_posts',
|
|
|
55 |
'respond_to_others_posts',
|
|
|
56 |
'respond_to_posts',
|
57 |
];
|
58 |
}
|
52 |
'publish_posts',
|
53 |
'read_post',
|
54 |
'read_private_posts',
|
55 |
+
'respond_to_others_post',
|
56 |
'respond_to_others_posts',
|
57 |
+
'respond_to_post',
|
58 |
'respond_to_posts',
|
59 |
];
|
60 |
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: reviews, ratings, testimonials, woocommerce, product reviews
|
|
5 |
Tested up to: 5.7
|
6 |
Requires at least: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 5.12.
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -137,7 +137,11 @@ All documentation can be found in the "Help" page of the plugin. If your questio
|
|
137 |
|
138 |
## Changelog
|
139 |
|
140 |
-
= 5.12.
|
|
|
|
|
|
|
|
|
141 |
|
142 |
- Added the "rating_field" shortcode option which allows you to use a custom rating field with the summary
|
143 |
- Added the "Repair Review Relations" tool
|
5 |
Tested up to: 5.7
|
6 |
Requires at least: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 5.12.1
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
137 |
|
138 |
## Changelog
|
139 |
|
140 |
+
= 5.12.1 (2021-06-12) =
|
141 |
+
|
142 |
+
- Fixed the "respond_to_*" capabilities, users can now respond to reviews if they are the author of one of the assigned posts
|
143 |
+
|
144 |
+
= 5.12.0 (2021-06-07) =
|
145 |
|
146 |
- Added the "rating_field" shortcode option which allows you to use a custom rating field with the summary
|
147 |
- Added the "Repair Review Relations" tool
|
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.12.
|
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.12.1
|
11 |
* Author: Paul Ryley
|
12 |
* Author URI: https://geminilabs.io
|
13 |
* License: GPL2
|