Plugin Directory

Changeset 3345146


Ignore:
Timestamp:
08/15/2025 12:31:09 PM (7 months ago)
Author:
wisernotify
Message:

Updating trunk to version 1.7

Location:
wiser-review/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wiser-review/trunk/readme.txt

    r3344301 r3345146  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.6
     8Stable tag: 1.7
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    112112= 1.6 =
    113113Fix- Product ID & SKU id issues, After update, submit the key again
     114
     115= 1.7 =
     116Fix- we separate the shortcode and toggle display, star rating position, data-lgin support
  • wiser-review/trunk/wiser-review.php

    r3344301 r3345146  
    44 * Plugin URI: https://wiserreview.com
    55 * Description: Wiser Review module helps you collect and display product reviews, star ratings, and nudges. It also automates review requests via email to boost custom engagement and conversions.
    6  * Version: 1.6
     6 * Version: 1.7
    77 * Author: Wiser Notify
    88 * Requires Plugins: woocommerce
     
    163163add_action( 'woocommerce_single_product_summary', 'wiserrw_show_rating_count', 5 );
    164164// fix for the kadence theme
    165 add_action( 'woocommerce_after_add_to_cart_button', 'wiserrw_show_rating_count' );
     165if ( wp_get_theme()->get( 'Name' ) === 'Kadence' ) {
     166    add_action( 'woocommerce_after_add_to_cart_button', 'wiserrw_show_rating_count' );
     167}
     168
    166169
    167170/**
     
    180183    $product_id = get_the_ID();
    181184    $product = wc_get_product( $product_id );
     185    if ( ! $product ) {
     186        return;
     187    }
    182188    $sku = $product->get_sku();
    183189
     
    208214function wiserrw_product_review() {
    209215    ob_start();
     216    $product_id = get_the_ID();
     217    $product = wc_get_product( $product_id );
     218    if ( ! $product ) {
     219        return;
     220    }
    210221    $wiserrw_api_settings = get_option( 'wiserrw_api_settings' );
    211222    if ( $wiserrw_api_settings && '1' === $wiserrw_api_settings['wiserrw_live_mode_checkbox'] && '1' === $wiserrw_api_settings['wiserrw_product_review_enabled'] ) {
    212         $product_id = get_the_ID();
    213         $product = wc_get_product( $product_id );
    214       $sku = $product->get_sku();
     223       
     224        $sku = $product->get_sku();
    215225        $wiserrw_api_data = get_option( 'wiserrw_api_data' );
    216         $product_review_section_pid = preg_replace( "/data-pid='(.*?)'/", "data-pid='$product_id'", $wiserrw_api_data->product_review_section );
     226        if ( is_user_logged_in() ) {
     227            $data_in_value = 'true';
     228        } else {
     229            $data_in_value = 'false';
     230        }
     231
     232        // If data-login exists, replace it; otherwise, add it to the first tag
     233        if ( preg_match( "/data-lgin=['\"](.*?)['\"]/", $wiserrw_api_data->product_review_section ) ) {
     234            $product_review_section_loggedin = preg_replace(
     235                "/data-lgin=['\"](.*?)['\"]/",
     236                "data-lgin='{$data_in_value}'",
     237                $wiserrw_api_data->product_review_section
     238            );
     239        } else {
     240            $product_review_section_loggedin = preg_replace(
     241                '/<(\w+)/',
     242                "<$1 data-lgin='{$data_in_value}'",
     243                $wiserrw_api_data->product_review_section,
     244                1 // only add to the first tag
     245            );
     246        }
     247        $product_review_section_pid = preg_replace( "/data-pid='(.*?)'/", "data-pid='$product_id'", $product_review_section_loggedin );
     248
    217249        $product_review_section = preg_replace( "/data-skuid='(.*?)'/", "data-skuid='$sku'", $product_review_section_pid );
    218250       
    219251        $product_rating_count = preg_replace( "/data-pid='(.*?)'/", "data-pid='$product_id'", $wiserrw_api_data->product_rating_count );
    220         $product_rating_count = preg_replace( "/data-skuid='(.*?)'/", "data-pid='$sku'", $wiserrw_api_data->product_rating_count );
     252        $product_rating_count = preg_replace( "/data-skuid='(.*?)'/", "data-skuid='$sku'", $wiserrw_api_data->product_rating_count );
    221253       
    222254        $nudges_section = preg_replace( "/data-pid='(.*?)'/", "data-pid='$product_id'", $wiserrw_api_data->nudges_section );
     
    244276function wiserrw_product_nudges() {
    245277    ob_start();
     278    $product_id = get_the_ID();
     279    $product = wc_get_product( $product_id );
     280    if ( ! $product ) {
     281        return;
     282    }
    246283    $wiserrw_api_settings = get_option( 'wiserrw_api_settings' );
    247284    if ( $wiserrw_api_settings && '1' === $wiserrw_api_settings['wiserrw_live_mode_checkbox'] && '1' === $wiserrw_api_settings['wiserrw_review_nudges_enabled'] ) {
    248285        $wiserrw_api_data = get_option( 'wiserrw_api_data' );
    249         $product_id = get_the_ID();
    250         $product_id = get_the_ID();
    251         $product = wc_get_product( $product_id );
    252286        $sku = $product->get_sku();
    253287       
Note: See TracChangeset for help on using the changeset viewer.