• Resolved emboldtyler

    (@emboldtyler)


    Just upgraded our site to PHP 8.1 and getting some error messages loading various pages when this plugin is activated:

    Undefined variable $msg_to_display at wp-content/plugins/discount-with-first-purchase-for-woocommerce/Front/plgfyqdp_main_front.php:1119)

    If I change the line from $$msg_to_display=''; to $msg_to_display=''; it works. Not sure if this is the best fix.

    Was also getting
    Attempt to read property \"roles\" on bool at wp-content/plugins/discount-with-first-purchase-for-woocommerce/Front/plgfyqdp_main_front.php:966)
    and
    Attempt to read property \"roles\" on bool at wp-content/plugins/discount-with-first-purchase-for-woocommerce/Front/plgfyqdp_main_front.php:1127

    Fixed by changing from:
    $user_roles=$user_meta->roles;
    to

    if (isset($user_meta->roles)) {
      $user_roles=$user_meta->roles;
    } else {
      $user_roles = [];
    }

    Also getting:
    Undefined array key \"applied_on\" at wp-content/plugins/discount-with-first-purchase-for-woocommerce/Front/plgfyqdp_main_front.php:1047
    and
    Undefined array key \"applied_on\" at wp-content/plugins/discount-with-first-purchase-for-woocommerce/Front/plgfyqdp_main_front.php:448

    Fixed by changing from:
    } else if ('whole' == $value['applied_on']) {
    to
    } else if (isset($value['applied_on']) && 'whole' == $value['applied_on']) {

    • This topic was modified 1 year, 12 months ago by emboldtyler.
    • This topic was modified 1 year, 12 months ago by emboldtyler.
    • This topic was modified 1 year, 12 months ago by emboldtyler.
    • This topic was modified 1 year, 12 months ago by emboldtyler. Reason: Adding additional errors/fixes
Viewing 1 replies (of 1 total)
  • Plugin Author Vidish

    (@vidishp)

    @emboldtyler I think you have mistaken to search plugin. This plugin is not developed by us. You need to reach out to correct author.

    Thank you!
    Vidish

Viewing 1 replies (of 1 total)
  • The topic ‘Undefined variable $msg_to_display , “roles” bool, undefined, PHP 8.1’ is closed to new replies.