Plugin Directory

Changeset 3836821


Ignore:
Timestamp:
12/01/2026 07:15:35 AM (63 minutes ago)
Author:
wpinterface
Message:

Release 1.0.4: per-product Reviews page, Write a review fix, tested with WordPress 7.2

Location:
wpinterface-product-reviews
Files:
2 added
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wpinterface-product-reviews/tags/1.0.4/languages/wpinterface-product-reviews.pot

    r3791721 r3836821  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WPInterface Product Reviews for WooCommerce 1.0.2\n"
     5"Project-Id-Version: WPInterface Product Reviews for WooCommerce 1.0.4\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpinterface-product-reviews\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    … …  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2026-11-07T11:47:53+00:00\n"
     12"POT-Creation-Date: 2026-11-30T02:00:52+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
    … …  
    3737#: src/Admin/AdminApps.php:64
    3838#: src/Admin/Menu.php:165
    39 #: src/Admin/Product/ProductMetaBox.php:69
     39#: src/Admin/Product/ProductMetaBox.php:70
    4040#: src/Collection/Account/MyReviews.php:108
    4141#: assets/src/admin/import/index.js:828
    … …  
    136136
    137137#. translators: 1: average rating, 2: number of ratings.
    138 #: src/Admin/Product/ProductMetaBox.php:95
     138#: src/Admin/Product/ProductMetaBox.php:96
    139139#, php-format
    140140msgid "Rated %1$s out of 5 from %2$s rating"
    … …  
    143143msgstr[1] ""
    144144
    145 #: src/Admin/Product/ProductMetaBox.php:98
     145#: src/Admin/Product/ProductMetaBox.php:99
    146146msgid "No ratings yet."
    147147msgstr ""
    148148
    149 #: src/Admin/Product/ProductMetaBox.php:102
     149#: src/Admin/Product/ProductMetaBox.php:103
    150150msgid "Manage this product’s reviews"
    151151msgstr ""
    152152
    153153#. translators: %s: number of reviews.
    154 #: src/Admin/Product/ProductMetaBox.php:116
     154#: src/Admin/Product/ProductMetaBox.php:117
    155155#, php-format
    156156msgid "%s waiting for approval"
    … …  
    159159msgstr[1] ""
    160160
    161 #: src/Admin/Product/ProductMetaBox.php:122
     161#: src/Admin/Product/ProductMetaBox.php:123
    162162msgid "Show the rating breakdown from"
    163163msgstr ""
    164164
    165 #: src/Admin/Product/ProductMetaBox.php:123
     165#: src/Admin/Product/ProductMetaBox.php:124
    166166msgid "store default"
    167167msgstr ""
    168168
    169 #: src/Admin/Product/ProductMetaBox.php:124
     169#: src/Admin/Product/ProductMetaBox.php:125
    170170msgid "ratings"
    171171msgstr ""
    172172
    173 #: src/Admin/Product/ProductMetaBox.php:126
     173#: src/Admin/Product/ProductMetaBox.php:127
    174174msgid "Leave empty to use the store’s setting. Turn reviews on or off for this product under Product data → Advanced."
     175msgstr ""
     176
     177#: src/Admin/Product/ProductMetaBox.php:129
     178msgid "Reviews page"
     179msgstr ""
     180
     181#: src/Admin/Product/ProductMetaBox.php:130
     182msgid "This product’s page"
     183msgstr ""
     184
     185#. translators: %s: shortcode.
     186#: src/Admin/Product/ProductMetaBox.php:135
     187#, php-format
     188msgid "Show this product’s reviews on another page of your site? Add %s to that page and enter its address here. Review request emails and rating links will then go there."
    175189msgstr ""
    176190
    … …  
    911925
    912926#: src/Admin/Tools/Health.php:287
    913 msgid "The chosen CAPTCHA comes with Pro, so the form runs without one. Choose Cloudflare Turnstile, or none."
     927msgid "The chosen CAPTCHA is not available on this site, so the form runs without one. Choose another CAPTCHA, or none."
    914928msgstr ""
    915929
    … …  
    18111825msgstr[1] ""
    18121826
    1813 #: src/Frontend/ReviewsRenderer.php:239
     1827#: src/Frontend/ReviewsRenderer.php:240
    18141828msgid "Ratings & reviews"
    18151829msgstr ""
    18161830
    1817 #: src/Frontend/ReviewsRenderer.php:535
     1831#: src/Frontend/ReviewsRenderer.php:552
    18181832msgid "Reviews marked “Verified buyer” come from customers whose order for this product we confirmed. Other reviews are not verified."
    18191833msgstr ""
    18201834
    1821 #: src/Frontend/ReviewsRenderer.php:536
     1835#: src/Frontend/ReviewsRenderer.php:553
    18221836msgid "We publish positive and negative reviews alike. We only remove reviews that break our review guidelines, such as spam, abuse or personal information."
    18231837msgstr ""
    18241838
    1825 #: src/Frontend/ReviewsRenderer.php:537
     1839#: src/Frontend/ReviewsRenderer.php:554
    18261840msgid "The overall rating is the average of every published star rating."
    18271841msgstr ""
    18281842
    1829 #: src/Frontend/ReviewsRenderer.php:538
     1843#: src/Frontend/ReviewsRenderer.php:555
    18301844msgid "Reviews written in exchange for a reward are labelled “Incentivised review”. Rewards never depend on the rating."
    18311845msgstr ""
    18321846
    1833 #: src/Frontend/ReviewsRenderer.php:556
     1847#: src/Frontend/ReviewsRenderer.php:573
    18341848msgid "No reviews match these filters."
    18351849msgstr ""
    18361850
    1837 #: src/Frontend/ReviewsRenderer.php:557
     1851#: src/Frontend/ReviewsRenderer.php:574
    18381852msgid "There are no reviews yet."
    18391853msgstr ""
    18401854
    18411855#. translators: 1: first review number, 2: last review number, 3: total reviews.
    1842 #: src/Frontend/ReviewsRenderer.php:561
     1856#: src/Frontend/ReviewsRenderer.php:578
    18431857#, php-format
    18441858msgid "Showing %1$s–%2$s of %3$s review"
  • wpinterface-product-reviews/tags/1.0.4/package.json

    r3791721 r3836821  
    11{
    22        "name": "wpinterface-product-reviews",
    3         "version": "1.0.3",
     3        "version": "1.0.4",
    44        "private": true,
    55        "description": "Ratings and reviews for WooCommerce, built for block and classic themes.",
  • wpinterface-product-reviews/tags/1.0.4/readme.txt

    r3791721 r3836821  
    33Tags: reviews, product reviews, photo reviews, review request, woocommerce
    44Requires at least: 6.9
    5 Tested up to: 7.1
     5Tested up to: 7.2
    66Requires PHP: 7.4
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    7676It works with block themes and classic themes. The system report on Reviews → Tools shows which way the reviews are added to your product pages. You can copy any template into your theme's `wpinterface-product-reviews` folder to change it.
    7777
     78= I build my pages with Elementor or another page builder. Which shortcodes are there? =
     79
     80`[wpipr_reviews product_id="123"]` shows a product's whole reviews section, review form included (`form="no"` leaves the form out). There are also `[wpipr_summary product_id="123"]`, `[wpipr_rating product_id="123"]`, `[wpipr_reviews_list products="12,15"]` and `[wpipr_store_rating]`. In Elementor, put them in a Shortcode widget. The product id is shown under the product's name in Products. To send review request emails to that page instead of the product page, enter its address under Reviews page in the product's Reviews box.
     81
    7882= Does it work with page caching? =
    7983
    … …  
    121125== Changelog ==
    122126
     127= 1.0.4 =
     128* New: a "Reviews page" for each product. Show a product's reviews on another page of your site, such as an Elementor page with the [wpipr_reviews] shortcode, and review request emails and rating links go there instead of the product page. The review still counts as a verified purchase.
     129* The reviews shortcode on a page other than the product page brings reviewers back to that page after they submit.
     130* "Write a review" is hidden when the reviews section shows no form.
     131* The FAQ lists the shortcodes for page builders.
     132* Tested with WordPress 7.2.
     133
    123134= 1.0.3 =
    124135* Security: reviews of private, draft or password-protected products, and reviews that are not approved, can no longer be reported, and the answer no longer shows whether they exist. Shortcodes, blocks and forms show nothing for products the visitor cannot see.
    … …  
    136147== Upgrade Notice ==
    137148
     149= 1.0.4 =
     150Adds a per-product "Reviews page" for stores that show reviews on page-builder pages.
     151
    138152= 1.0.3 =
    139153Fixes from the third WordPress.org review: hidden reviews can no longer be reported.
  • wpinterface-product-reviews/tags/1.0.4/src/Admin/Product/ProductMetaBox.php

    r3791721 r3836821  
    1414use WPInterface\ProductReviews\Reviews\Aggregates;
    1515use WPInterface\ProductReviews\Reviews\ReviewMeta;
     16use WPInterface\ProductReviews\Reviews\ReviewsLocation;
    1617
    1718defined( 'ABSPATH' ) || exit;
    … …  
    125126                </p>
    126127                <p class="description"><?php esc_html_e( 'Leave empty to use the store’s setting. Turn reviews on or off for this product under Product data → Advanced.', 'wpinterface-product-reviews' ); ?></p>
     128                <p>
     129                        <label for="wpipr-review-page"><?php esc_html_e( 'Reviews page', 'wpinterface-product-reviews' ); ?></label>
     130                        <input type="url" class="widefat" id="wpipr-review-page" name="wpipr_review_page" value="<?php echo esc_attr( ReviewsLocation::custom( $id ) ); ?>" placeholder="<?php esc_attr_e( 'This product’s page', 'wpinterface-product-reviews' ); ?>">
     131                </p>
     132                <p class="description">
     133                        <?php
     134                        /* translators: %s: shortcode. */
     135                        echo esc_html( sprintf( __( 'Show this product’s reviews on another page of your site? Add %s to that page and enter its address here. Review request emails and rating links will then go there.', 'wpinterface-product-reviews' ), '[wpipr_reviews product_id="' . $id . '"]' ) );
     136                        ?>
     137                </p>
    127138                <?php
    128139                /**
    … …  
    155166                }
    156167
     168                $page = isset( $_POST['wpipr_review_page'] ) ? ReviewsLocation::sanitize( esc_url_raw( wp_unslash( $_POST['wpipr_review_page'] ) ) ) : '';
     169                if ( '' === $page ) {
     170                        delete_post_meta( $post_id, ReviewMeta::REVIEW_PAGE );
     171                } else {
     172                        update_post_meta( $post_id, ReviewMeta::REVIEW_PAGE, $page );
     173                }
     174
    157175                /**
    158176                 * Fires after the Reviews box's fields were saved.
  • wpinterface-product-reviews/tags/1.0.4/src/Frontend/ReviewsRenderer.php

    r3791721 r3836821  
    2222use WPInterface\ProductReviews\Reviews\Query\ReviewRequest;
    2323use WPInterface\ProductReviews\Reviews\ReviewMeta;
     24use WPInterface\ProductReviews\Reviews\ReviewsLocation;
    2425use WPInterface\ProductReviews\Reviews\Summary;
    2526use WPInterface\ProductReviews\Reviews\View\MediaStrip;
    … …  
    230231
    231232                $title = (string) $this->options->get( 'display', 'section_title' );
     233                $form  = $args['show_form'] ? $this->form_html( $product, $summary, $this->form_return_url( $product_id ) ) : '';
    232234
    233235                $html = $this->templates->render(
    … …  
    244246                                        'anchor'   => $anchor,
    245247                                ),
    246                                 'summary'      => $this->summary_html( $product, $summary, $query, $base_url, $anchor ),
     248                                // "Write a review" jumps to the form, so it is left out when the section has none.
     249                                'summary'      => $this->summary_html( $product, $summary, $query, $base_url, $anchor, '' === $form ? '' : '#review_form' ),
    247250                                'media'        => $this->media_html( $product_id, $section_id ),
    248251                                'toolbar'      => $summary->review_count > 0 ? $this->toolbar_html( $query, $summary, $base_url, $anchor, $section_id ) : '',
    249252                                'results'      => $this->results_html( $page, $base_url, $anchor ),
    250                                 'form'         => $args['show_form'] ? $this->form_html( $product, $summary ) : '',
     253                                'form'         => $form,
    251254                                'lightbox'     => $this->templates->render( 'reviews/lightbox.php', array( 'section_id' => $section_id ) ),
    252255                                'review_count' => $summary->review_count,
    … …  
    320323         * @param string      $base_url Page URL.
    321324         * @param string      $anchor   Section anchor.
    322          * @param string      $cta_url  "Write a review" link; the form on this page by default.
     325         * @param string      $cta_url  "Write a review" link; the form on this page by default, '' for no button.
    323326         */
    324327        public function summary_html( \WC_Product $product, Summary $summary, ReviewQuery $query, string $base_url, string $anchor, string $cta_url = '#review_form' ): string {
    … …  
    334337                                'cta_text'   => (string) $this->options->get( 'display', 'cta_text' ),
    335338                                'cta_url'    => $cta_url,
    336                                 'can_review' => $product->get_reviews_allowed() && comments_open( $product->get_id() ),
     339                                'can_review' => '' !== $cta_url && $product->get_reviews_allowed() && comments_open( $product->get_id() ),
    337340                                'disclosure' => $this->options->get( 'display', 'show_disclosure' ) ? $this->disclosure_html() : '',
    338341                        )
    … …  
    515518         * Review form. Phase 1 keeps WooCommerce's own form so reviews can still be submitted.
    516519         *
    517          * @param \WC_Product $product Product.
    518          * @param Summary     $summary Summary.
    519          */
    520         public function form_html( \WC_Product $product, Summary $summary ): string {
    521                 return null === $this->form ? '' : $this->form->render( $product, $summary );
     520         * @param \WC_Product $product     Product.
     521         * @param Summary     $summary     Summary.
     522         * @param string      $redirect_to Where the no-JavaScript form returns; '' for the product page.
     523         */
     524        public function form_html( \WC_Product $product, Summary $summary, string $redirect_to = '' ): string {
     525                return null === $this->form ? '' : $this->form->render( $product, $summary, $redirect_to );
     526        }
     527
     528        /**
     529         * Where the no-JavaScript form returns after posting: this page when the section is shown
     530         * on a page other than the product's own (a shortcode on a landing page), so the
     531         * reviewer is not sent to a product page the store may redirect elsewhere.
     532         *
     533         * @param int $product_id Product id.
     534         */
     535        private function form_return_url( int $product_id ): string {
     536                if ( ! is_singular() || ( is_singular( 'product' ) && (int) get_queried_object_id() === $product_id ) ) {
     537                        return '';
     538                }
     539                $url = get_permalink( get_queried_object_id() );
     540                return is_string( $url ) ? $url : '';
    522541        }
    523542
    … …  
    577596                }
    578597                $this->enqueue();
    579                 $permalink = (string) $product->get_permalink();
    580                 $on_page   = is_singular( 'product' ) && (int) get_queried_object_id() === $product_id;
     598                $url = ReviewsLocation::url( $product );
    581599
    582600                return '<div class="wpipr wpipr-summary-card">' . $this->summary_html(
    … …  
    584602                        $this->aggregates->display( $product_id ),
    585603                        $this->query( array( $product_id ), array() ),
    586                         $permalink,
    587                         'reviews',
    588                         $on_page ? '#review_form' : $permalink . '#review_form'
     604                        $url,
     605                        self::anchor( $product ),
     606                        ReviewsLocation::is_current( $product ) ? '#review_form' : $url . '#review_form'
    589607                ) . '</div>';
    590608        }
    … …  
    603621                }
    604622                $this->assets->enqueue_style( Assets::FRONTEND_STYLE );
    605                 $on_page = is_singular( 'product' ) && (int) get_queried_object_id() === $product_id;
     623                $anchor = '#' . self::anchor( $product );
    606624
    607625                return $this->templates->render(
    … …  
    610628                                'summary'    => $this->aggregates->display( $product_id ),
    611629                                'show_count' => $show_count,
    612                                 'link'       => $link ? ( $on_page ? '#reviews' : (string) $product->get_permalink() . '#reviews' ) : '',
     630                                'link'       => $link ? ( ReviewsLocation::is_current( $product ) ? $anchor : ReviewsLocation::url( $product ) . $anchor ) : '',
    613631                        )
    614632                );
     633        }
     634
     635        /**
     636         * Element id of the product's reviews section on its reviews page: "reviews" on the
     637         * product page, the section's own id on a page set as its "Reviews page".
     638         *
     639         * @param \WC_Product $product Product.
     640         */
     641        private static function anchor( \WC_Product $product ): string {
     642                $on_product = is_singular( 'product' ) && (int) get_queried_object_id() === $product->get_id();
     643                return $on_product || '' === ReviewsLocation::custom( $product->get_id() ) ? 'reviews' : 'wpipr-reviews-' . $product->get_id();
    615644        }
    616645
  • wpinterface-product-reviews/tags/1.0.4/src/Requests/ReviewLinks.php

    r3791721 r3836821  
    1010namespace WPInterface\ProductReviews\Requests;
    1111
     12use WPInterface\ProductReviews\Reviews\ReviewsLocation;
     13
    1214defined( 'ABSPATH' ) || exit;
    1315
    1416/**
    15  * Lite links each product to its own page, where the token marks the review as written for
    16  * the order. Pro links to the "Review your order" page, where every item can be reviewed at
    17  * once. Star links pre-select the rating.
     17 * Lite links each product to its own page (or the "Reviews page" set for it), where the
     18 * token marks the review as written for the order. Pro links to the "Review your order"
     19 * page, where every item can be reviewed at once. Star links pre-select the rating.
    1820 */
    1921final class ReviewLinks {
    … …  
    5759                }
    5860
    59                 $url  = (string) $product->get_permalink();
     61                $url  = ReviewsLocation::url( $product );
    6062                $args = array();
    6163                if ( '' !== $token ) {
  • wpinterface-product-reviews/tags/1.0.4/src/Reviews/ReviewMeta.php

    r3791721 r3836821  
    7070        public const MIN_RATINGS = '_wpipr_min_ratings';
    7171
     72        // Product meta: page on this site where the product's reviews and form are shown, when
     73        // not the product page (empty: the product page). See ReviewsLocation.
     74        public const REVIEW_PAGE = '_wpipr_review_page';
     75
    7276        /**
    7377         * Comment meta keys whose change affects a product's summary.
  • wpinterface-product-reviews/tags/1.0.4/wpinterface-product-reviews.php

    r3791721 r3836821  
    44 * Plugin URI:           https://wpinterface.com/plugins/wpinterface-product-reviews/
    55 * Description:          Photo reviews, review request emails and a faster, clearer reviews section for WooCommerce, for block and classic themes.
    6  * Version:              1.0.3
     6 * Version:              1.0.4
    77 * Author:               WPInterface
    88 * Author URI:           https://wpinterface.com/
    … …  
    7878}
    7979
    80 define( 'WPIPR_VERSION', '1.0.3' );
     80define( 'WPIPR_VERSION', '1.0.4' );
    8181define( 'WPIPR_PLUGIN_FILE', __FILE__ );
    8282define( 'WPIPR_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • wpinterface-product-reviews/trunk/languages/wpinterface-product-reviews.pot

    r3791721 r3836821  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: WPInterface Product Reviews for WooCommerce 1.0.2\n"
     5"Project-Id-Version: WPInterface Product Reviews for WooCommerce 1.0.4\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wpinterface-product-reviews\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    … …  
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2026-11-07T11:47:53+00:00\n"
     12"POT-Creation-Date: 2026-11-30T02:00:52+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
    … …  
    3737#: src/Admin/AdminApps.php:64
    3838#: src/Admin/Menu.php:165
    39 #: src/Admin/Product/ProductMetaBox.php:69
     39#: src/Admin/Product/ProductMetaBox.php:70
    4040#: src/Collection/Account/MyReviews.php:108
    4141#: assets/src/admin/import/index.js:828
    … …  
    136136
    137137#. translators: 1: average rating, 2: number of ratings.
    138 #: src/Admin/Product/ProductMetaBox.php:95
     138#: src/Admin/Product/ProductMetaBox.php:96
    139139#, php-format
    140140msgid "Rated %1$s out of 5 from %2$s rating"
    … …  
    143143msgstr[1] ""
    144144
    145 #: src/Admin/Product/ProductMetaBox.php:98
     145#: src/Admin/Product/ProductMetaBox.php:99
    146146msgid "No ratings yet."
    147147msgstr ""
    148148
    149 #: src/Admin/Product/ProductMetaBox.php:102
     149#: src/Admin/Product/ProductMetaBox.php:103
    150150msgid "Manage this product’s reviews"
    151151msgstr ""
    152152
    153153#. translators: %s: number of reviews.
    154 #: src/Admin/Product/ProductMetaBox.php:116
     154#: src/Admin/Product/ProductMetaBox.php:117
    155155#, php-format
    156156msgid "%s waiting for approval"
    … …  
    159159msgstr[1] ""
    160160
    161 #: src/Admin/Product/ProductMetaBox.php:122
     161#: src/Admin/Product/ProductMetaBox.php:123
    162162msgid "Show the rating breakdown from"
    163163msgstr ""
    164164
    165 #: src/Admin/Product/ProductMetaBox.php:123
     165#: src/Admin/Product/ProductMetaBox.php:124
    166166msgid "store default"
    167167msgstr ""
    168168
    169 #: src/Admin/Product/ProductMetaBox.php:124
     169#: src/Admin/Product/ProductMetaBox.php:125
    170170msgid "ratings"
    171171msgstr ""
    172172
    173 #: src/Admin/Product/ProductMetaBox.php:126
     173#: src/Admin/Product/ProductMetaBox.php:127
    174174msgid "Leave empty to use the store’s setting. Turn reviews on or off for this product under Product data → Advanced."
     175msgstr ""
     176
     177#: src/Admin/Product/ProductMetaBox.php:129
     178msgid "Reviews page"
     179msgstr ""
     180
     181#: src/Admin/Product/ProductMetaBox.php:130
     182msgid "This product’s page"
     183msgstr ""
     184
     185#. translators: %s: shortcode.
     186#: src/Admin/Product/ProductMetaBox.php:135
     187#, php-format
     188msgid "Show this product’s reviews on another page of your site? Add %s to that page and enter its address here. Review request emails and rating links will then go there."
    175189msgstr ""
    176190
    … …  
    911925
    912926#: src/Admin/Tools/Health.php:287
    913 msgid "The chosen CAPTCHA comes with Pro, so the form runs without one. Choose Cloudflare Turnstile, or none."
     927msgid "The chosen CAPTCHA is not available on this site, so the form runs without one. Choose another CAPTCHA, or none."
    914928msgstr ""
    915929
    … …  
    18111825msgstr[1] ""
    18121826
    1813 #: src/Frontend/ReviewsRenderer.php:239
     1827#: src/Frontend/ReviewsRenderer.php:240
    18141828msgid "Ratings & reviews"
    18151829msgstr ""
    18161830
    1817 #: src/Frontend/ReviewsRenderer.php:535
     1831#: src/Frontend/ReviewsRenderer.php:552
    18181832msgid "Reviews marked “Verified buyer” come from customers whose order for this product we confirmed. Other reviews are not verified."
    18191833msgstr ""
    18201834
    1821 #: src/Frontend/ReviewsRenderer.php:536
     1835#: src/Frontend/ReviewsRenderer.php:553
    18221836msgid "We publish positive and negative reviews alike. We only remove reviews that break our review guidelines, such as spam, abuse or personal information."
    18231837msgstr ""
    18241838
    1825 #: src/Frontend/ReviewsRenderer.php:537
     1839#: src/Frontend/ReviewsRenderer.php:554
    18261840msgid "The overall rating is the average of every published star rating."
    18271841msgstr ""
    18281842
    1829 #: src/Frontend/ReviewsRenderer.php:538
     1843#: src/Frontend/ReviewsRenderer.php:555
    18301844msgid "Reviews written in exchange for a reward are labelled “Incentivised review”. Rewards never depend on the rating."
    18311845msgstr ""
    18321846
    1833 #: src/Frontend/ReviewsRenderer.php:556
     1847#: src/Frontend/ReviewsRenderer.php:573
    18341848msgid "No reviews match these filters."
    18351849msgstr ""
    18361850
    1837 #: src/Frontend/ReviewsRenderer.php:557
     1851#: src/Frontend/ReviewsRenderer.php:574
    18381852msgid "There are no reviews yet."
    18391853msgstr ""
    18401854
    18411855#. translators: 1: first review number, 2: last review number, 3: total reviews.
    1842 #: src/Frontend/ReviewsRenderer.php:561
     1856#: src/Frontend/ReviewsRenderer.php:578
    18431857#, php-format
    18441858msgid "Showing %1$s–%2$s of %3$s review"
  • wpinterface-product-reviews/trunk/package.json

    r3791721 r3836821  
    11{
    22        "name": "wpinterface-product-reviews",
    3         "version": "1.0.3",
     3        "version": "1.0.4",
    44        "private": true,
    55        "description": "Ratings and reviews for WooCommerce, built for block and classic themes.",
  • wpinterface-product-reviews/trunk/readme.txt

    r3791721 r3836821  
    33Tags: reviews, product reviews, photo reviews, review request, woocommerce
    44Requires at least: 6.9
    5 Tested up to: 7.1
     5Tested up to: 7.2
    66Requires PHP: 7.4
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    7676It works with block themes and classic themes. The system report on Reviews → Tools shows which way the reviews are added to your product pages. You can copy any template into your theme's `wpinterface-product-reviews` folder to change it.
    7777
     78= I build my pages with Elementor or another page builder. Which shortcodes are there? =
     79
     80`[wpipr_reviews product_id="123"]` shows a product's whole reviews section, review form included (`form="no"` leaves the form out). There are also `[wpipr_summary product_id="123"]`, `[wpipr_rating product_id="123"]`, `[wpipr_reviews_list products="12,15"]` and `[wpipr_store_rating]`. In Elementor, put them in a Shortcode widget. The product id is shown under the product's name in Products. To send review request emails to that page instead of the product page, enter its address under Reviews page in the product's Reviews box.
     81
    7882= Does it work with page caching? =
    7983
    … …  
    121125== Changelog ==
    122126
     127= 1.0.4 =
     128* New: a "Reviews page" for each product. Show a product's reviews on another page of your site, such as an Elementor page with the [wpipr_reviews] shortcode, and review request emails and rating links go there instead of the product page. The review still counts as a verified purchase.
     129* The reviews shortcode on a page other than the product page brings reviewers back to that page after they submit.
     130* "Write a review" is hidden when the reviews section shows no form.
     131* The FAQ lists the shortcodes for page builders.
     132* Tested with WordPress 7.2.
     133
    123134= 1.0.3 =
    124135* Security: reviews of private, draft or password-protected products, and reviews that are not approved, can no longer be reported, and the answer no longer shows whether they exist. Shortcodes, blocks and forms show nothing for products the visitor cannot see.
    … …  
    136147== Upgrade Notice ==
    137148
     149= 1.0.4 =
     150Adds a per-product "Reviews page" for stores that show reviews on page-builder pages.
     151
    138152= 1.0.3 =
    139153Fixes from the third WordPress.org review: hidden reviews can no longer be reported.
  • wpinterface-product-reviews/trunk/src/Admin/Product/ProductMetaBox.php

    r3791721 r3836821  
    1414use WPInterface\ProductReviews\Reviews\Aggregates;
    1515use WPInterface\ProductReviews\Reviews\ReviewMeta;
     16use WPInterface\ProductReviews\Reviews\ReviewsLocation;
    1617
    1718defined( 'ABSPATH' ) || exit;
    … …  
    125126                </p>
    126127                <p class="description"><?php esc_html_e( 'Leave empty to use the store’s setting. Turn reviews on or off for this product under Product data → Advanced.', 'wpinterface-product-reviews' ); ?></p>
     128                <p>
     129                        <label for="wpipr-review-page"><?php esc_html_e( 'Reviews page', 'wpinterface-product-reviews' ); ?></label>
     130                        <input type="url" class="widefat" id="wpipr-review-page" name="wpipr_review_page" value="<?php echo esc_attr( ReviewsLocation::custom( $id ) ); ?>" placeholder="<?php esc_attr_e( 'This product’s page', 'wpinterface-product-reviews' ); ?>">
     131                </p>
     132                <p class="description">
     133                        <?php
     134                        /* translators: %s: shortcode. */
     135                        echo esc_html( sprintf( __( 'Show this product’s reviews on another page of your site? Add %s to that page and enter its address here. Review request emails and rating links will then go there.', 'wpinterface-product-reviews' ), '[wpipr_reviews product_id="' . $id . '"]' ) );
     136                        ?>
     137                </p>
    127138                <?php
    128139                /**
    … …  
    155166                }
    156167
     168                $page = isset( $_POST['wpipr_review_page'] ) ? ReviewsLocation::sanitize( esc_url_raw( wp_unslash( $_POST['wpipr_review_page'] ) ) ) : '';
     169                if ( '' === $page ) {
     170                        delete_post_meta( $post_id, ReviewMeta::REVIEW_PAGE );
     171                } else {
     172                        update_post_meta( $post_id, ReviewMeta::REVIEW_PAGE, $page );
     173                }
     174
    157175                /**
    158176                 * Fires after the Reviews box's fields were saved.
  • wpinterface-product-reviews/trunk/src/Frontend/ReviewsRenderer.php

    r3791721 r3836821  
    2222use WPInterface\ProductReviews\Reviews\Query\ReviewRequest;
    2323use WPInterface\ProductReviews\Reviews\ReviewMeta;
     24use WPInterface\ProductReviews\Reviews\ReviewsLocation;
    2425use WPInterface\ProductReviews\Reviews\Summary;
    2526use WPInterface\ProductReviews\Reviews\View\MediaStrip;
    … …  
    230231
    231232                $title = (string) $this->options->get( 'display', 'section_title' );
     233                $form  = $args['show_form'] ? $this->form_html( $product, $summary, $this->form_return_url( $product_id ) ) : '';
    232234
    233235                $html = $this->templates->render(
    … …  
    244246                                        'anchor'   => $anchor,
    245247                                ),
    246                                 'summary'      => $this->summary_html( $product, $summary, $query, $base_url, $anchor ),
     248                                // "Write a review" jumps to the form, so it is left out when the section has none.
     249                                'summary'      => $this->summary_html( $product, $summary, $query, $base_url, $anchor, '' === $form ? '' : '#review_form' ),
    247250                                'media'        => $this->media_html( $product_id, $section_id ),
    248251                                'toolbar'      => $summary->review_count > 0 ? $this->toolbar_html( $query, $summary, $base_url, $anchor, $section_id ) : '',
    249252                                'results'      => $this->results_html( $page, $base_url, $anchor ),
    250                                 'form'         => $args['show_form'] ? $this->form_html( $product, $summary ) : '',
     253                                'form'         => $form,
    251254                                'lightbox'     => $this->templates->render( 'reviews/lightbox.php', array( 'section_id' => $section_id ) ),
    252255                                'review_count' => $summary->review_count,
    … …  
    320323         * @param string      $base_url Page URL.
    321324         * @param string      $anchor   Section anchor.
    322          * @param string      $cta_url  "Write a review" link; the form on this page by default.
     325         * @param string      $cta_url  "Write a review" link; the form on this page by default, '' for no button.
    323326         */
    324327        public function summary_html( \WC_Product $product, Summary $summary, ReviewQuery $query, string $base_url, string $anchor, string $cta_url = '#review_form' ): string {
    … …  
    334337                                'cta_text'   => (string) $this->options->get( 'display', 'cta_text' ),
    335338                                'cta_url'    => $cta_url,
    336                                 'can_review' => $product->get_reviews_allowed() && comments_open( $product->get_id() ),
     339                                'can_review' => '' !== $cta_url && $product->get_reviews_allowed() && comments_open( $product->get_id() ),
    337340                                'disclosure' => $this->options->get( 'display', 'show_disclosure' ) ? $this->disclosure_html() : '',
    338341                        )
    … …  
    515518         * Review form. Phase 1 keeps WooCommerce's own form so reviews can still be submitted.
    516519         *
    517          * @param \WC_Product $product Product.
    518          * @param Summary     $summary Summary.
    519          */
    520         public function form_html( \WC_Product $product, Summary $summary ): string {
    521                 return null === $this->form ? '' : $this->form->render( $product, $summary );
     520         * @param \WC_Product $product     Product.
     521         * @param Summary     $summary     Summary.
     522         * @param string      $redirect_to Where the no-JavaScript form returns; '' for the product page.
     523         */
     524        public function form_html( \WC_Product $product, Summary $summary, string $redirect_to = '' ): string {
     525                return null === $this->form ? '' : $this->form->render( $product, $summary, $redirect_to );
     526        }
     527
     528        /**
     529         * Where the no-JavaScript form returns after posting: this page when the section is shown
     530         * on a page other than the product's own (a shortcode on a landing page), so the
     531         * reviewer is not sent to a product page the store may redirect elsewhere.
     532         *
     533         * @param int $product_id Product id.
     534         */
     535        private function form_return_url( int $product_id ): string {
     536                if ( ! is_singular() || ( is_singular( 'product' ) && (int) get_queried_object_id() === $product_id ) ) {
     537                        return '';
     538                }
     539                $url = get_permalink( get_queried_object_id() );
     540                return is_string( $url ) ? $url : '';
    522541        }
    523542
    … …  
    577596                }
    578597                $this->enqueue();
    579                 $permalink = (string) $product->get_permalink();
    580                 $on_page   = is_singular( 'product' ) && (int) get_queried_object_id() === $product_id;
     598                $url = ReviewsLocation::url( $product );
    581599
    582600                return '<div class="wpipr wpipr-summary-card">' . $this->summary_html(
    … …  
    584602                        $this->aggregates->display( $product_id ),
    585603                        $this->query( array( $product_id ), array() ),
    586                         $permalink,
    587                         'reviews',
    588                         $on_page ? '#review_form' : $permalink . '#review_form'
     604                        $url,
     605                        self::anchor( $product ),
     606                        ReviewsLocation::is_current( $product ) ? '#review_form' : $url . '#review_form'
    589607                ) . '</div>';
    590608        }
    … …  
    603621                }
    604622                $this->assets->enqueue_style( Assets::FRONTEND_STYLE );
    605                 $on_page = is_singular( 'product' ) && (int) get_queried_object_id() === $product_id;
     623                $anchor = '#' . self::anchor( $product );
    606624
    607625                return $this->templates->render(
    … …  
    610628                                'summary'    => $this->aggregates->display( $product_id ),
    611629                                'show_count' => $show_count,
    612                                 'link'       => $link ? ( $on_page ? '#reviews' : (string) $product->get_permalink() . '#reviews' ) : '',
     630                                'link'       => $link ? ( ReviewsLocation::is_current( $product ) ? $anchor : ReviewsLocation::url( $product ) . $anchor ) : '',
    613631                        )
    614632                );
     633        }
     634
     635        /**
     636         * Element id of the product's reviews section on its reviews page: "reviews" on the
     637         * product page, the section's own id on a page set as its "Reviews page".
     638         *
     639         * @param \WC_Product $product Product.
     640         */
     641        private static function anchor( \WC_Product $product ): string {
     642                $on_product = is_singular( 'product' ) && (int) get_queried_object_id() === $product->get_id();
     643                return $on_product || '' === ReviewsLocation::custom( $product->get_id() ) ? 'reviews' : 'wpipr-reviews-' . $product->get_id();
    615644        }
    616645
  • wpinterface-product-reviews/trunk/src/Requests/ReviewLinks.php

    r3791721 r3836821  
    1010namespace WPInterface\ProductReviews\Requests;
    1111
     12use WPInterface\ProductReviews\Reviews\ReviewsLocation;
     13
    1214defined( 'ABSPATH' ) || exit;
    1315
    1416/**
    15  * Lite links each product to its own page, where the token marks the review as written for
    16  * the order. Pro links to the "Review your order" page, where every item can be reviewed at
    17  * once. Star links pre-select the rating.
     17 * Lite links each product to its own page (or the "Reviews page" set for it), where the
     18 * token marks the review as written for the order. Pro links to the "Review your order"
     19 * page, where every item can be reviewed at once. Star links pre-select the rating.
    1820 */
    1921final class ReviewLinks {
    … …  
    5759                }
    5860
    59                 $url  = (string) $product->get_permalink();
     61                $url  = ReviewsLocation::url( $product );
    6062                $args = array();
    6163                if ( '' !== $token ) {
  • wpinterface-product-reviews/trunk/src/Reviews/ReviewMeta.php

    r3791721 r3836821  
    7070        public const MIN_RATINGS = '_wpipr_min_ratings';
    7171
     72        // Product meta: page on this site where the product's reviews and form are shown, when
     73        // not the product page (empty: the product page). See ReviewsLocation.
     74        public const REVIEW_PAGE = '_wpipr_review_page';
     75
    7276        /**
    7377         * Comment meta keys whose change affects a product's summary.
  • wpinterface-product-reviews/trunk/wpinterface-product-reviews.php

    r3791721 r3836821  
    44 * Plugin URI:           https://wpinterface.com/plugins/wpinterface-product-reviews/
    55 * Description:          Photo reviews, review request emails and a faster, clearer reviews section for WooCommerce, for block and classic themes.
    6  * Version:              1.0.3
     6 * Version:              1.0.4
    77 * Author:               WPInterface
    88 * Author URI:           https://wpinterface.com/
    … …  
    7878}
    7979
    80 define( 'WPIPR_VERSION', '1.0.3' );
     80define( 'WPIPR_VERSION', '1.0.4' );
    8181define( 'WPIPR_PLUGIN_FILE', __FILE__ );
    8282define( 'WPIPR_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.