• Resolved stvanderhoek

    (@stvanderhoek)


    Hi team,

    As the title describes, unfortunately the sort=”RAND” is not working in my shortcode(s), and creates a fatal error on my website when inputted in the slider function.
    ASC and DESC do work.

    Here’s an example of my shortcode:

    [cusrev_reviews_slider sort="RAND" count="0" slides_to_show="3" show_summary_bar="true"
    color_brdr="#69cae2" color_bcrd="#ffffff" color_pr_bcrd="#f4f4f4" color_stars="#69cae2" shop_reviews="true" count_shop_reviews="10" autoplay="false" avatars="initials" max_chars="100" min_chars="0" show_dots="true" number_shop_reviews="-1"]


    Strange thing is I’ve tried the same RAND sort function on my cusrev_all_reviews shortcode, where it does not create a fatal error, but it does not work either.

    Hope you can help.

    Thanks in advance,
    Stephanie

    • This topic was modified 2 years, 11 months ago by stvanderhoek.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support pear8398

    (@pear8398)

    Hi,

    Thanks for using CusRev.

    Please enable WP debug log and share the error when you see the fatal error on your site.

    Debugging in WordPress

    Thread Starter stvanderhoek

    (@stvanderhoek)

    Thanks for the quick reply.

    PHP Fatal error: Uncaught ValueError: array_rand(): Argument #2 ($num) must be between 1 and the number of elements in argument #1 ($array) in /var/www/vhosts/bubblesbathnbody.nl/httpdocs/wp-content/plugins/customer-reviews-woocommerce/includes/blocks/class-cr-reviews-slider.php:241

    Plugin Support pear8398

    (@pear8398)

    Hi,

    It looks related to PHP 8.0 or later. Does your site have any reviews? You can try to downgrade PHP to 7.4 to fix this issue.

    Plugin Support pistachio6321

    (@pistachio6321)

    We did further investigation and this issue has been fixed in the version 5.31.1. Please update the plugin and let us know in case of any issues.

    Thread Starter stvanderhoek

    (@stvanderhoek)

    Thanks team. I was just going to respond I cannot downgrade my PHP as of obvious reasons like performance and since most my plugings depend on it. I’ll update it and test it tonight!

    Thread Starter stvanderhoek

    (@stvanderhoek)

    Thanks lads, the random function within the slider works now!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Sort RAND not working in slider shortcode’ is closed to new replies.