Skip to content

Commit 4b99bcc

Browse files
authored
Merge pull request #81 from n49/slider_v1.1.9
fixed facebook reviewer avatar bug
2 parents 3bf55f9 + 6f7d7ec commit 4b99bcc

7 files changed

Lines changed: 57 additions & 8 deletions

assets/css/slick-theme.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/class-slider-deserializer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public function get_allowed_tags() {
5959
'style' => true,
6060
'class' => true,
6161
'data-glide-el' => true,
62+
'data-fb-avatar' => true,
6263
'onclick' => true,
6364
),
6465
'section' => array(),

includes/reviews-slider-horizontal-carousel-template.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ function isMobileDevice() {
167167
<div style="display: flex; position: relative;" >
168168
<div style="vertical-align: top;">
169169
<div class="avatar-container">
170-
<?php if(($review['propertyId'] === 1 || $review['propertyId'] === 2 || $review['propertyId'] === 3 || $review['propertyId'] === 5) && isset($review['user']['userPic'])) { ?>
170+
<?php if($review['propertyId'] === 2 && isset($review['user']['userPic'])) { ?>
171+
<div class="reviewer-avatar" data-fb-avatar="<?php echo esc_attr($review['user']['userPic']); ?>">
172+
</div>
173+
<?php } else if(($review['propertyId'] === 1 || $review['propertyId'] === 3 || $review['propertyId'] === 5) && isset($review['user']['userPic'])) { ?>
171174
<div class="reviewer-avatar" style="background-image: url(<?php echo esc_attr($review['user']['userPic']);?>);">
172175
</div>
173176
<?php } else if(isset($review['user']['userPic']) && isset($review['user']['userPic']['imageId'])) { ?>
@@ -438,6 +441,19 @@ function isMobileDevice() {
438441
</div>
439442
</div>
440443

444+
<script>
445+
(function() {
446+
// Set background images for all Facebook avatars
447+
var avatars = document.querySelectorAll('.reviewer-avatar[data-fb-avatar]');
448+
avatars.forEach(function(avatar) {
449+
var url = avatar.getAttribute('data-fb-avatar');
450+
if (url) {
451+
avatar.style.backgroundImage = 'url("' + url + '")';
452+
}
453+
});
454+
})();
455+
</script>
456+
441457
<?php } else { ?>
442458
<div class="opio-more-reviews-required">
443459
<p class="opio-more-error-note">Error: More than 3 reviews are required for the widget</p>

includes/reviews-slider-horizontal-template.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ function randomColor() {
166166
<div class="testimonial-slide review-tile" data-review-index="<?php echo esc_attr($index); ?>" onclick="openPhotoLightbox(<?php echo esc_attr(json_encode($currentReview)); ?>)">
167167
<div id=<?php echo esc_attr($review["_id"]);?> class="reviewer-container">
168168
<div class="avatar-container">
169-
<?php if(($review['propertyId'] === 1 || $review['propertyId'] === 2 || $review['propertyId'] === 3 || $review['propertyId'] === 5) && isset($review['user']['userPic'])) { ?>
169+
<?php if($review['propertyId'] === 2 && isset($review['user']['userPic'])) { ?>
170+
<div class="reviewer-avatar" data-fb-avatar="<?php echo esc_attr($review['user']['userPic']); ?>">
171+
</div>
172+
<?php } else if(($review['propertyId'] === 1 || $review['propertyId'] === 3 || $review['propertyId'] === 5) && isset($review['user']['userPic'])) { ?>
170173
<div class="reviewer-avatar" style="background-image: url(<?php echo esc_attr($review['user']['userPic']);?>);">
171174
</div>
172175
<?php } else if(isset($review['user']['userPic']) && isset($review['user']['userPic']['imageId'])) { ?>
@@ -429,6 +432,19 @@ function randomColor() {
429432
</div>
430433
</div>
431434

435+
<script>
436+
(function() {
437+
// Set background images for all Facebook avatars
438+
var avatars = document.querySelectorAll('.reviewer-avatar[data-fb-avatar]');
439+
avatars.forEach(function(avatar) {
440+
var url = avatar.getAttribute('data-fb-avatar');
441+
if (url) {
442+
avatar.style.backgroundImage = 'url("' + url + '")';
443+
}
444+
});
445+
})();
446+
</script>
447+
432448
<?php } else { ?>
433449

434450
<div class="opio-more-reviews-required">

includes/reviews-slider-vertical-template.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ function randomColor() {
193193
<div class="testimonial-slide review-tile-vertical" data-review-index="<?php echo esc_attr($index); ?>" onclick="openPhotoLightbox(<?php echo esc_attr(json_encode($currentReview)); ?>)">
194194
<div id=<?php echo esc_attr($review["_id"]);?> class="v-review-tile-container">
195195
<div class="v-rev-content">
196-
<?php if(($review['propertyId'] === 1 || $review['propertyId'] === 2 || $review['propertyId'] === 3 || $review['propertyId'] === 5) && isset($review['user']['userPic'])) { ?>
196+
<?php if($review['propertyId'] === 2 && isset($review['user']['userPic'])) { ?>
197+
<div class="v-reviewer-avatar" data-fb-avatar="<?php echo esc_attr($review['user']['userPic']); ?>">
198+
</div>
199+
<?php } else if(($review['propertyId'] === 1 || $review['propertyId'] === 3 || $review['propertyId'] === 5) && isset($review['user']['userPic'])) { ?>
197200
<div class="v-reviewer-avatar" style="background-image: url(<?php echo esc_attr($review['user']['userPic']);?>);">
198201
</div>
199202
<?php } else if(isset($review['user']['userPic']) && isset($review['user']['userPic']['imageId'])) { ?>
@@ -317,6 +320,19 @@ function randomColor() {
317320
</div>
318321
</div>
319322

323+
<script>
324+
(function() {
325+
// Set background images for all Facebook avatars
326+
var avatars = document.querySelectorAll('.v-reviewer-avatar[data-fb-avatar]');
327+
avatars.forEach(function(avatar) {
328+
var url = avatar.getAttribute('data-fb-avatar');
329+
if (url) {
330+
avatar.style.backgroundImage = 'url("' + url + '")';
331+
}
332+
});
333+
})();
334+
</script>
335+
320336
<?php } else { ?>
321337
<div class="opio-more-reviews-required">
322338
<p class="opio-more-error-note">Error: More than 3 reviews are required for the widget</p>

opio.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Widget for OPIO Reviews
44
Plugin URI:
55
Description: Instantly add OPIO Reviews on your website to increase user confidence and SEO.
6-
Version: 1.1.8
6+
Version: 1.1.9
77
Author: Dhiraj Timalsina <dhiraj@n49.com>
88
Text Domain: widget-for-opio-reviews
99
Domain Path: /languages
@@ -22,7 +22,7 @@
2222

2323
require(ABSPATH . 'wp-includes/version.php');
2424

25-
define('OPIO_PLUGIN_VERSION' , '1.1.8');
25+
define('OPIO_PLUGIN_VERSION' , '1.1.9');
2626
define('OPIO_PLUGIN_FILE' , __FILE__);
2727
define('OPIO_PLUGIN_URL' , plugins_url(basename(plugin_dir_path(__FILE__ )), basename(__FILE__)));
2828
define('OPIO_ASSETS_URL' , OPIO_PLUGIN_URL . '/assets/');

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Author: Dhiraj Timalsina
33
Tags: Widget for OPIO Reviews, opio, reviews, rating, widget, google business, testimonials
44
Tested up to: 6.4
5-
Stable tag: 1.1.8
5+
Stable tag: 1.1.9
66
License: GPLv2 or later
77
License URI: http://www.gnu.org/licenses/gpl-2.0.html
88

0 commit comments

Comments
 (0)