Support » Plugin: Pay For Post with WooCommerce » warning after website update

  • Resolved wxia0822

    (@wxia0822hotmailcom)


    I updated the staging website and got this warning on all Buddypress related pages:

    Warning: Invalid argument supplied for foreach() in /homepages/23/d747873564/htdocs/clickandbuilds/test/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-public.php on line 368

    Screenshot: https://imgur.com/a/wQLlluD

    WP: 4.9.8
    WooCommerce: 3.4.5
    WooCommerce Pay Per Post: 2.1.13
    BuddyPress: 3.2.0

    It is a staging site so no urgency on this.

    Thanks.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • I am having the same warning on a production site with a bbPress forum, except it is also preventing the page from loading correctly. Our forum root is set to show Topics by freshness:

    https://www.cashflowdepot.com/community/

    Page 1 & page 2 work ok but page 3+ are not accessible. They display “Oops, restricted content”.

    https://www.cashflowdepot.com/community/page/3/

    When I access the site on a staging server set to expose errors I also see:

    Invalid argument supplied for foreach() in /nas/content/staging/cashflowdepot/wp-content/plugins/woocommerce-pay-per-post/public/class-woocommerce-pay-per-post-public.php on line 368

    Interestingly, if a user is browsing a specific forum (rather than all forums) all of the pages work:

    https://www.cashflowdepot.com/community/forum/creative-real-estate-discussions/page/3/

    In a staging environment with WP 4.9.8 I switched to Twenty Seventeen 1.7 and deactivated all plugins except:

    bbPress 2.5.14
    WooCommerce 3.4.6
    WooCommerce Pay Per Post 2.1.13

    ..and the problem persists.

    Plugin Author Matt Pramschufer

    (@mattpramschufer)

    In the actual class-woocommerce-pay-per-post-public.php file on line 368 can you replace

    foreach ( $product_ids as $id ) {
    with

    foreach ( (array) $product_ids as $id ) {

    And see if that removes the warning messages for you.

    Thank you. This removes the PHP warning from bbPress and BuddyPress but does not resolve the conflict with bbPress.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘warning after website update’ is closed to new replies.