diff --git a/config/integrations/woocommerce.php b/config/integrations/woocommerce.php index a709c570..e61a03d4 100644 --- a/config/integrations/woocommerce.php +++ b/config/integrations/woocommerce.php @@ -72,7 +72,7 @@ 'label' => _x('Product Sorting', 'admin-text', 'site-reviews'), 'options' => [ '' => _x('Average Rating', 'admin-text', 'site-reviews'), - 'bayesian' => _x('Bayesian Average Rating', 'admin-text', 'site-reviews'), + 'bayesian' => _x('Bayesian Ranking', 'admin-text', 'site-reviews'), ], 'sanitizer' => 'text', 'tooltip' => _x('This is the method used to sort products by rating on the shop page.', 'admin-text', 'site-reviews'), @@ -83,7 +83,7 @@ 'depends_on' => [ 'settings.integrations.woocommerce.enabled' => ['yes'], ], - 'label' => _x('Display empty ratings?', 'admin-text', 'site-reviews'), + 'label' => _x('Display Empty Ratings?', 'admin-text', 'site-reviews'), 'sanitizer' => 'text', 'tooltip' => _x('This will display the rating stars even if the product has no reviews.', 'admin-text', 'site-reviews'), 'type' => 'yes_no', diff --git a/plugin/Integrations/WooCommerce/Controllers/ProductController.php b/plugin/Integrations/WooCommerce/Controllers/ProductController.php index 8ab5937d..45c7dcf3 100644 --- a/plugin/Integrations/WooCommerce/Controllers/ProductController.php +++ b/plugin/Integrations/WooCommerce/Controllers/ProductController.php @@ -338,7 +338,7 @@ public function renderLoopRating(): void return; } $ratings = glsr_get_ratings(['assigned_posts' => 'post_id']); - if (0 >= $ratings->average && 'no' === glsr_get_option('integrations.woocommerce.display_empty')) { + if (0 >= $ratings->average && !glsr_get_option('integrations.woocommerce.display_empty', false, 'bool')) { return; } glsr(Template::class)->render('templates/woocommerce/loop/rating', [ @@ -399,7 +399,7 @@ public function renderTitleRating(): void { global $product; $ratings = glsr_get_ratings(['assigned_posts' => 'post_id']); - if (0 >= $ratings->average && 'no' === glsr_get_option('integrations.woocommerce.display_empty')) { + if (0 >= $ratings->average && !glsr_get_option('integrations.woocommerce.display_empty', false, 'bool')) { return; } glsr(Template::class)->render('templates/woocommerce/rating', [ diff --git a/plugin/Shortcodes/SiteReviewsFormShortcode.php b/plugin/Shortcodes/SiteReviewsFormShortcode.php index eb9bd1d3..894ef06a 100644 --- a/plugin/Shortcodes/SiteReviewsFormShortcode.php +++ b/plugin/Shortcodes/SiteReviewsFormShortcode.php @@ -61,6 +61,21 @@ public function loginLink(): string ]); } + public function loginOrRegister(): string + { + $loginText = sprintf(__('You must be %s to submit a review.', 'site-reviews'), $this->loginLink()); + $registerLink = $this->registerLink(); + $registerText = ''; + if (glsr_get_option('general.require.register', false, 'bool') && !empty($registerLink)) { + $registerText = sprintf(__('You may also %s for an account.', 'site-reviews'), $registerLink); + } + return glsr(Template::class)->build('templates/login-register', [ + 'context' => [ + 'text' => trim("{$loginText} {$registerText}"), + ], + ]); + } + public function loginUrl(): string { add_filter('login_url', [$this, 'filterLoginUrl'], 20, 3); @@ -119,21 +134,6 @@ protected function hideOptions(): array ]; } - protected function loginOrRegister(): string - { - $loginText = sprintf(__('You must be %s to submit a review.', 'site-reviews'), $this->loginLink()); - $registerLink = $this->registerLink(); - $registerText = ''; - if (glsr_get_option('general.require.register', false, 'bool') && !empty($registerLink)) { - $registerText = sprintf(__('You may also %s for an account.', 'site-reviews'), $registerLink); - } - return glsr(Template::class)->build('templates/login-register', [ - 'context' => [ - 'text' => trim("{$loginText} {$registerText}"), - ], - ]); - } - /** * @param string $value */