• Resolved curtisnew

    (@curtisnew)


    Hi, when i activate the plugin, pages contained a payperpost are not accessible with “page error”. Here the server error log:

    32151#0: *24 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Cannot use object of type WP_Post as array in /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/partials/shortcode-all.php:13
    Stack trace:
    #0 /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-shortcodes.php(127): require()
    #1 /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-shortcodes.php(57): Woocommerce_Pay_Per_Post_Shortcodes::shortcode_all('all', Array)
    #2 /var/www/vhosts/mysite.com/httpdocs/wp-includes/shortcodes.php(343): Woocommerce_Pay_Per_Post_Shortcodes::process_shortcode(Array, '', 'woocommerce-pay...')
    #3 [internal function]: do_shortcode_tag(Array)
    #4 /var/www/vhosts/mysite.com/httpdocs/wp-includes/shortcodes.php(218): preg_replace_callback('/\\[(\\[?)(woocom...', 'do_shortcode_ta...', '\n<h3>Voici votr...')
    #5 /var/www/vhosts/l" while reading response header from upstream

    I understood that is because of the short code [woocommerce-payperpost template=’all’] inside the page, it crash the page. But the short code [woocommerce-payperpost template=’purchased’] work. So do you know why “ALL” don’t work ?

    I use the lastest version of plugin 2.6.8, woocommerce 5.4.1 and wordpress 5.7.2.

    • This topic was modified 3 years, 8 months ago by curtisnew.
    • This topic was modified 3 years, 8 months ago by curtisnew.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Pramschufer

    (@mattpramschufer)

    hey @curtisnew
    That is totally a bug. It is already fixed in version 3.0 which will be coming out this weekend. In the meantime goto /var/www/vhosts/mysite.com/httpdocs/wp-content/plugins/woocommerce-pay-per-post/public/partials/shortcode-all.php on line 13 and change $post[‘ID’] to be $post->ID

    Thread Starter curtisnew

    (@curtisnew)

    this is line 13:
    if ( Woocommerce_Pay_Per_Post_Helper::has_access( $post['post_id'] ) ) {
    Is not the same. So what is the final result ? thanks

    Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Change that to be

    if ( Woocommerce_Pay_Per_Post_Helper::has_access( $post->ID ) ) {

    Thread Starter curtisnew

    (@curtisnew)

    Great, it works ! Thanks a lot

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Page error when plugin activated’ is closed to new replies.