strangerstudios/pmpro-courses

Fatal error: Call to undefined function pmpro_has_membership_access

Opened this issue · 0 comments

Describe the bug
A user reported that the fatal error Call to undefined function pmpro_has_membership_access() in /path_to_root/wp-content/plugins/pmpro-courses/includes/courses.php:209 was triggered on their site.

This would occur if the PMPro core plugin is not active.

The courses add-on uses the pmpro_has_membership_access function and the pmpro_membership_content_filter, pmpro_has_membership_access_filter, and pmpro_after_all_membership_level_changes hooks in various places. All these depend on the PMPro core plugin being active.

To Reproduce
Steps to reproduce the behavior:

  1. Create a course and restrict it to all membership levels
  2. Deactivate the Paid Memberships Pro core plugin
  3. Navigate to the frontend course page as a non-logged-in user in an incognito/private browser window
  4. See error

Expected behavior
No fatal errors should be triggered when PMPro core is deactivated.

Isolating the problem (mark completed items with an [x]):

  • I have deactivated other plugins and confirmed this bug occurs when only Paid Memberships Pro plugin is active.
  • This bug happens with a default WordPress theme active, or Memberlite.
  • I can reproduce this bug consistently using the steps above.

WordPress Environment

Paid Memberships Pro 2.12.3
PMPro Courses 1.2.5