strangerstudios / pmpro-gift-levels

Allow members to purchase gift codes for membership at checkout.
https://www.paidmembershipspro.com/add-ons/pmpro-gift-levels/
7 stars 12 forks source link

Fatal error when PMPro is deactivated #67

Closed michaelbeil closed 3 months ago

michaelbeil commented 1 year ago

Describe the bug If PMPro is deactivated and I activate the Gift Levels Add On, there is a fatal error.

To Reproduce Steps to reproduce the behavior:

  1. Go to Plugins
  2. Deactivate PMPro
  3. Activate the Gift Levels Add On
  4. Visit homepage
  5. See error
    
    Fatal error: Uncaught Error: Call to undefined function pmpro_is_checkout() in /public_html/wp-content/plugins/pmpro-gift-levels/includes/checkout.php:51 

Stack trace:

0 /public_html/wp-includes/class-wp-hook.php(310): pmprogl_enqueue_checkout_script('')

1 //public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)

2 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

3 /public_html/wp-includes/script-loader.php(2225): do_action('wp_enqueue_scri...')

4 /public_html/wp-includes/class-wp-hook.php(310): wp_enqueue_scripts('')

5 /public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)

6 /public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

7 /home/www/ in /public_html/wp-content/plugins/pmpro-gift-levels/includes/checkout.php on line 51


**Expected behavior**
They should not be an error. 

**Isolating the problem:**
- [x] I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro and the Gift Levels Add On is active.
- [x] This bug happens with a default WordPress theme active, or [Memberlite](https://wordpress.org/themes/memberlite/).
- [x] I can reproduce this bug consistently using the steps above.

**WordPress Environment**
<details>

Paid Memberships Pro 2.12.2, WordPress 6.3.1, PHP 8.0.29```

kimcoleman commented 3 months ago

This is resolved in v1.0.4: https://github.com/strangerstudios/pmpro-gift-levels/blob/dev/readme.txt#L39