Yasr – Yet Another Stars Rating - Version 2.2.1

Version Description

  • FIXED: MultiSet returns "undefined" in editor screen
  • FIXED: MultiSet average always shows
  • FIXED: Users who cannot publish posts can't access the editor screen
  • FIXED: Password reset display an error page in some circumstances
Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 Yasr – Yet Another Stars Rating
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2.0 to 2.2.1

changelog.txt CHANGED
@@ -64,7 +64,7 @@ TWEAKED: code cleanup
64
= 1.8.7 =
65
* FIXED: Security fix
66
* FIXED: if yasr_visitor_votes is used twice in the same page, loader and results are now shown in the right place
67
- * TWEAKED: updated freemius sdk to version 2.2.3git
68
* NEW FEATURE: Yasr now works with WP Fastest Cache – WordPress Cache plugin by Emre Vona
69
* NEW FEATURE: Yasr now works with Cache Enabler – WordPress Cache plugin by KeyCDN
70
64
= 1.8.7 =
65
* FIXED: Security fix
66
* FIXED: if yasr_visitor_votes is used twice in the same page, loader and results are now shown in the right place
67
+ * TWEAKED: updated freemius sdk to version 2.2.3
68
* NEW FEATURE: Yasr now works with WP Fastest Cache – WordPress Cache plugin by Emre Vona
69
* NEW FEATURE: Yasr now works with Cache Enabler – WordPress Cache plugin by KeyCDN
70
js/yasr-admin.js CHANGED
@@ -112,9 +112,9 @@ function yasrPrintAdminMultiSet(setId, postid, moreThanOneMultiSet) {
112
113
for (var i = 0; i < yasrMultiSetValue.length; i++) {
114
115
- var valueName = yasrMultiSetValue[i]['value_name'];
116
- var valueRating = yasrMultiSetValue[i]['value_rating'];
117
- var valueID = yasrMultiSetValue[i]['value_id'];
118
119
content += '<tr>';
120
content += '<td>' + valueName + '</td>';
112
113
for (var i = 0; i < yasrMultiSetValue.length; i++) {
114
115
+ var valueName = yasrMultiSetValue[i]['name'];
116
+ var valueRating = yasrMultiSetValue[i]['average_rating'];
117
+ var valueID = yasrMultiSetValue[i]['id'];
118
119
content += '<tr>';
120
content += '<td>' + valueName + '</td>';
lib/admin/editor/yasr-editor-functions.php CHANGED
@@ -146,7 +146,7 @@ function yasr_add_metaboxes() {
146
147
function yasr_metabox_overall_rating_content() {
148
149
- if (current_user_can('publish_posts')) {
150
include(YASR_ABSOLUTE_PATH . '/lib/admin/editor/yasr-metabox-top-right.php');
151
} else {
152
_e("You don't have enought privileges to insert Overall Rating");
@@ -156,7 +156,7 @@ function yasr_metabox_overall_rating_content() {
156
157
function yasr_metabox_multiple_rating_content() {
158
159
- if (current_user_can('publish_posts')) {
160
include(YASR_ABSOLUTE_PATH . '/lib/admin/editor/yasr-metabox-multiple-rating.php');
161
} else {
162
_e("You don't have enough privileges to insert a Multi Set");
146
147
function yasr_metabox_overall_rating_content() {
148
149
+ if (current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
150
include(YASR_ABSOLUTE_PATH . '/lib/admin/editor/yasr-metabox-top-right.php');
151
} else {
152
_e("You don't have enought privileges to insert Overall Rating");
156
157
function yasr_metabox_multiple_rating_content() {
158
159
+ if (current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
160
include(YASR_ABSOLUTE_PATH . '/lib/admin/editor/yasr-metabox-multiple-rating.php');
161
} else {
162
_e("You don't have enough privileges to insert a Multi Set");
lib/yasr-ajax-functions.php CHANGED
@@ -41,7 +41,7 @@ function yasr_output_multiple_set_callback() {
41
exit();
42
}
43
44
- if (!current_user_can('publish_posts')) {
45
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
46
}
47
41
exit();
42
}
43
44
+ if (!current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
45
wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
46
}
47
lib/yasr-db-functions.php CHANGED
@@ -382,8 +382,8 @@ function yasr_insert_overall_rating_callback($post_id) {
382
return;
383
}
384
385
- if (!current_user_can('publish_posts')) {
386
- wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
387
}
388
389
if (!wp_verify_nonce($nonce, 'yasr_nonce_overall_rating_action')) {
@@ -425,8 +425,8 @@ add_action('save_post', 'yasr_insert_review_type_callback');
425
426
function yasr_insert_review_type_callback($post_id) {
427
//if user can not publish posts
428
- if (!current_user_can('publish_posts')) {
429
- wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
430
}
431
432
//this mean there we're not in the classic editor
@@ -475,8 +475,8 @@ function yasr_post_a_review($post_id) {
475
$nonce = $_POST['yasr_nonce_is_post_review'];
476
}
477
478
- if (!current_user_can('publish_posts')) {
479
- wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
480
}
481
482
if (!wp_verify_nonce($nonce, 'yasr_nonce_is_post_review_action')) {
@@ -511,8 +511,8 @@ function yasr_save_multiset_editor($post_id) {
511
return;
512
}
513
514
- if (!current_user_can('publish_posts')) {
515
- wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
516
}
517
518
if (!wp_verify_nonce($nonce, 'yasr_nonce_save_multi_values_action')) {
382
return;
383
}
384
385
+ if (!current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
386
+ return;
387
}
388
389
if (!wp_verify_nonce($nonce, 'yasr_nonce_overall_rating_action')) {
425
426
function yasr_insert_review_type_callback($post_id) {
427
//if user can not publish posts
428
+ if (!current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
429
+ return;
430
}
431
432
//this mean there we're not in the classic editor
475
$nonce = $_POST['yasr_nonce_is_post_review'];
476
}
477
478
+ if (!current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
479
+ return;
480
}
481
482
if (!wp_verify_nonce($nonce, 'yasr_nonce_is_post_review_action')) {
511
return;
512
}
513
514
+ if (!current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
515
+ return;
516
}
517
518
if (!wp_verify_nonce($nonce, 'yasr_nonce_save_multi_values_action')) {
lib/yasr-shortcode-classes.php CHANGED
@@ -565,7 +565,7 @@ class YasrMultiSet extends YasrShortcode {
565
$html_average = null;
566
567
//Show average row
568
- if ($show_average !== null && $show_average !== 'no'|| $show_average===null && YASR_MULTI_SHOW_AVERAGE !== 'no') {
569
$unique_id_identifier = $multiset_string . str_shuffle(uniqid());
570
571
$html_average = "<tr>
565
$html_average = null;
566
567
//Show average row
568
+ if ($show_average === '' && YASR_MULTI_SHOW_AVERAGE !== 'no' || $show_average !== '' && $show_average !== 'no') {
569
$unique_id_identifier = $multiset_string . str_shuffle(uniqid());
570
571
$html_average = "<tr>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
5
Contributors: Dudo
6
Tested up to: 5.4
7
Requires PHP: 5.3
8
- Stable tag: 2.2.0
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
@@ -125,6 +125,12 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
125
126
The full changelog can be found in the plugin's directory. Recent entries:
127
128
= 2.2.0 =
129
* TWEAKED: most of code of the main shortcodes has been rewritten; YASR is faster than ever.
130
* FIXED: gutenberg shortcode preview yasr_top_ten_highest_rated shortcode
5
Contributors: Dudo
6
Tested up to: 5.4
7
Requires PHP: 5.3
8
+ Stable tag: 2.2.1
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
125
126
The full changelog can be found in the plugin's directory. Recent entries:
127
128
+ = 2.2.1 =
129
+ * FIXED: MultiSet returns "undefined" in editor screen
130
+ * FIXED: MultiSet average always shows
131
+ * FIXED: Users who cannot publish posts can't access the editor screen
132
+ * FIXED: Password reset display an error page in some circumstances
133
+
134
= 2.2.0 =
135
* TWEAKED: most of code of the main shortcodes has been rewritten; YASR is faster than ever.
136
* FIXED: gutenberg shortcode preview yasr_top_ten_highest_rated shortcode
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
* Plugin Name: Yet Another Stars Rating
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
- * Version: 2.2.0
8
* Author: Dario Curvino
9
* Author URI: https://dariocurvino.it/
10
* Text Domain: yet-another-stars-rating
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
76
yasr_fs();
77
// Signal that SDK was initiated.
78
do_action( 'yasr_fs_loaded' );
79
- define( 'YASR_VERSION_NUM', '2.2.0' );
80
//Plugin relative path
81
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
//Plugin RELATIVE PATH without slashes (just the directory's name)
@@ -223,6 +223,8 @@ if ( !function_exists( 'yasr_fs' ) ) {
223
'Other'
224
) );
225
define( "YASR_SUPPORTED_SCHEMA_TYPES", $supported_schema_types );
226
$yasr_version_installed = get_option( 'yasr-version' );
227
global $yasr_version_installed ;
228
$yasr_plugin_imported = get_option( 'yasr_plugin_imported' );
4
* Plugin Name: Yet Another Stars Rating
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
+ * Version: 2.2.1
8
* Author: Dario Curvino
9
* Author URI: https://dariocurvino.it/
10
* Text Domain: yet-another-stars-rating
76
yasr_fs();
77
// Signal that SDK was initiated.
78
do_action( 'yasr_fs_loaded' );
79
+ define( 'YASR_VERSION_NUM', '2.2.1' );
80
//Plugin relative path
81
define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
//Plugin RELATIVE PATH without slashes (just the directory's name)
223
'Other'
224
) );
225
define( "YASR_SUPPORTED_SCHEMA_TYPES", $supported_schema_types );
226
+ //role to save overall_rating and multi set
227
+ define( 'YASR_USER_CAPABILITY_EDIT_POST', 'edit_posts' );
228
$yasr_version_installed = get_option( 'yasr-version' );
229
global $yasr_version_installed ;
230
$yasr_plugin_imported = get_option( 'yasr_plugin_imported' );