Git Product home page Git Product logo

strangerstudios / pmpro-courses Goto Github PK

View Code? Open in Web Editor NEW
3.0 6.0 13.0 690 KB

Create courses with lessons and manage member access access natively in Paid Memberships Pro. Also integrates membership with third party LMS plugins like LifterLMS, LearnDash, Tutor LMS, and Sensei LMS.

Home Page: https://www.paidmembershipspro.com/add-ons/pmpro-courses-lms-integration/

PHP 31.90% CSS 7.43% JavaScript 60.67%
wordpress wordpress-plugin paid-memberships-pro learndash lifterlms strangerstudios-product

pmpro-courses's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pmpro-courses's Issues

Issue with automatic enrollment and unenrollment and MMPU.

Describe the bug
There are various inconsistencies with MMPU and auto enrollment and unenrollment. Specifically around level ID's and order of checkout as well as cancellations.

I've been testing this with LearnDash, but I assume it will affect all modules that leverage this code.

I'm going to merge these two issues into one issue (as they are closely related - let me know if you need me to break these issues into separate issues rather).

Summary of issues

  1. There is an issue when you purchase a membership level with a higher ID, then signup for a lower level ID. This causes you to lose active enrollments even though you did not cancel your first level purchased.
  2. When cancelling a level, but there are still other active levels on your profile (MMPU) it does not unenroll automatically for the level cancelled. It only unenrolls you from the last and only level on your account before having no levels left.

Reference to code: https://github.com/strangerstudios/pmpro-courses/blob/dev/includes/modules/learndash.php#L247 (pmpro_after_all_membership_level_changes)

To Reproduce

Be sure to create courses that do not have multiple levels assigned for this test. I.e. Course A = Level 1, Course B = Level 2 (so we can clearly test the enrollment/unenrollment course ID's).

ISSUE 1 (Purchasing different levels = loses enrollment)

  1. Purchase level ID 2 and see you are enrolled to Course B (for example)
  2. Navigate to purchase level ID 1 - make sure you do not cancel level 2. You will be removed from Course B and given access to Course A.

If you do the inverse of this (i.e. Purchase level 2 and then level 3 = all fine).

ISSUE 2 (Cancelling = no unenrollment)

  1. Be sure to purchase level 1 and then level 2 to be assigned to multiple courses. Check that you are enrolled correctly.
  2. Cancel level 2, see that you are not unenrolled from Course B (or courses assigned to level 2)
  3. With only level 1 left, cancel level 1. See that you are unenrolled from Course A (or courses assigned to level 1).

Only the last level cancelled = unenrolled. I have not tested this by cancelling multiple level ID's.

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

``` Please share non-sensitive information about your hosting environment such as WordPress version, PHP version, Paid Memberships Pro and any related plugins versions. ```

Integration with Addon Packages

To sell courses with PMPro Courses, you can create multiple levels. You can use the MMPU add on to sell multiple courses.

You should also be able to use the Addon Packages plugin to sell courses. Even when MMPU is in core PMPro, it might be easier/better for some folks to sell through Addon Packages.

So let's make sure Course CPTs show a AP price. And let's make sure that sub pages in general, but specifically with PMPro Courses, are protected if the parent Course hasn't been purchased yet.

This work will mostly be done in the PMPro Addon Packages plugin.

Avoid generalized course/lesson post type names

Is your feature request related to a problem? Please describe.

I am worried there could be some conflicts with the choice of post types we have gone with on this project.

Describe the solution you'd like

The course and lesson post types could be namespaced as pmpro_course and pmpro_lesson to help avoid those potential conflicts.

Additional notes

I'm also unsure whether the integration with other LMS plugins means the post types have to remain the generalized names or not.

Updating to PMPro courses 1.2.2 breaks existing links

Describe the bug
Updating PMPro Courses to 1.2.2 causes existing lesson URLs to change. The lesson post type slug is rewritten to pmpro_lesson .

This can be problematic if you have previously shared lesson links or hardcoded them somewhere.

To Reproduce
Steps to reproduce the behavior:

  1. Install an older version of PMPro Courses eg. 1.2.1
  2. Create a course and add a lesson.
  3. Visit the course page and make note of the lesson URL.
  4. Update to PMPro Courses 1.2.2
  5. Visit the lesson URL from Step 3, observe 404

Expected behavior
Pre-existing lesson URLs still lead to the lesson page.

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

PMPro 2.11.2 PMPro Courses for Membership 1.2.2 WP 6.2.2

Additional option to associate membership levels to Learndash groups

Currently it is only possible to assign courses directly to one ore more membership levels. However, sometimes it is more practical to be able to sell Learndash groups with a membership, e.g. when a "Premium" level will have new courses added to it as time goes by.

This way, when a new course is added to the group, it will be automatically assigned to members of the "Premium" subscription without having to add it manually to their accounts.

Error with selecting course setting

In the settings where you must choose a module, it's possible to select between Default, LearnDash, or LifterLMS.

I chose the default setting, clicked Save Settings, and it said successful.

However the checkbox then unticks itself and there is no course menu item in the admin menu.

I have installed this on a clean server without issues so there seems to be a plugin conflict I can't find.

Environment
Wordpress 5.8.1
PHP 8.0
Paid Memberships Pro 2.6.3

Allow a lesson saved to draft to be assigned to a course

When a draft lesson is not yet published, it cannot be added to a course.

A site owner might want to create a course with a future publishing date, but have all their content (lessons) ready and assigned to the said course and saved in the draft, if they are not able to add the lessons saved to the draft, they would need to wait till the day of publishing to publish all lessons then add to the course.

Fatal error: Call to undefined function pmpro_has_membership_access

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

Lifter LMS course pages return 404 if default module is selected.

Describe the bug
When the default and lifter lms modules are both selected, the Lifter lms courses pages return 404 and aren't rendered

To Reproduce
Steps to reproduce the behavior:
Having both, Lifterlms plugin and PMPro Courses Add On activated.

  1. Go to wp-admin/admin.php?page=pmpro-courses-settings
  2. Check both, default and LifterLMS modules.
  3. Save setttings
  4. Navigate to any course page

Screenshots
image
image
image

Expected behavior
Lifter course should work despite default module is enabled.

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

``` PHP 8.1 WP 6.3 PMPro dev branch fork. PMPro Courses 1.2.1 ```

Feature for course sections

Is your feature request related to a problem? Please describe.
Long courses often have sections that group similar course content. These can also sometimes be called modules. This helps long courses stay organized and supports learners reaching smaller milestones along the way "you've completed module 2".

Describe the solution you'd like
Let's consider a way to add sections so that lessons are grouped. This could be done from the metabox where lessons are added to the course. We do not need a new CPT or a new landing page / screen on the frontend for a section.

We could optionally support section as an attribute of some shortcodes, but not needed. This is more of a visual grouping than navigational.

Note if a lesson is already part of a course when adding from the edit course page.

Is your feature request related to a problem? Please describe.
The dropdown of lessons shows ALL lessons, even if they are already part of another course or even the current course. This can cause confusion if lessons have similar names or give users the chance to "steal" a lesson from another course accidentally.

Describe the solution you'd like
One option would be to note the parent course in parenthesis after the lesson name.

Describe alternatives you've considered
Another option might be to have a toggle to include/exclude lessons that are already attached.

Or both.

Add support for Approvals

Is your feature request related to a problem? Please describe.
Members are automatically enrolled even when they haven't been approved

Describe the solution you'd like
Add support for our Approvals Add On

Describe alternatives you've considered
None possible as we can't hook in before enrollment happens to prevent it from happening

Additional context
Modes Only #517769

Add a 'New Lesson' link on the courses page

Is your feature request related to a problem? Please describe.
It feels like an extra step to have to go out of your course to create the first lesson.

Describe the solution you'd like
Adding in a link in the 'Lessons' meta box to 'Add New Lesson' would make it one step quicker to create your first lesson

Describe alternatives you've considered
Save the course and then go back to the Courses tab and click All Lessons and go from there.

Additional context
N/A.

Integration with PMPro CPT

Users may be already protecting LearnDash or Lifter CPTs with our PMPro CPT plugin. If PMPro courses is active and those modules are turned on, we should remove the LD and Lifter CPTs from the list considered by PMPro CPT. We want to make sure the "require membership" box isn't added twice and that users are NOT redirected away from course pages... let PMPro Courses handle it.

Basically, if PMPro Courses is active and in use, let that plugin handle course CPTs instead of the PMPro CPT one.

Drip (series) compatible

Compatibility with drip (series) would be nice, because when you add a meta box from (CPT) Membership Access to a lesson cpt, not everything works as it should

PHP 8.0 or higher causes a fatal error email

Describe the bug
When you click the “Edit” button next to to a block, a fatal error email will be sent

To Reproduce
Steps to reproduce the behavior on customer site:

  1. Install Courses for Membership Add On
  2. Set PHP version to PHP 8.0 or higher, click the “Edit” button next to the block, the following email will be sent:

Since WordPress 5.2 there is a built-in feature that detects when a plugin or theme causes a fatal error on your site, and notifies you with this automated email.

In this case, WordPress caught an error with one of your plugins, Paid Memberships Pro – Courses for Membership Add On.

First, visit your website (http://domain.com/) and check for any visible issues. Next, visit the page where the error was caught (http://domain.com/wp-json/jetpack/v4/sync/spawn-sync?time=1661219907&request_lock_id=1661219907.7152) and check for any visible issues.

Please contact your host for assistance with investigating this issue further.

If your site appears broken and you can’t access your dashboard normally, WordPress now has a special “recovery mode”. This lets you safely login to your dashboard and investigate further.

When seeking help with this issue, you may be asked for some of the following information:
WordPress version 6.0.1
Active theme: Divi (version 4.18.0)
Current plugin: Paid Memberships Pro – Courses for Membership Add On (version 1.1)
PHP version 8.1.8

Error Details

=============
An error of type E_ERROR was caused in line 52 of the file /home/x/public_html/wp-content/plugins/pmpro-courses/includes/admin.php. Error message: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /home/x/public_html/wp-content/plugins/pmpro-courses/includes/admin.php:52
Stack trace:
#0 /home/x/public_html/wp-content/plugins/pmpro-courses/includes/admin.php(52): array_merge()
#1 /home/x/public_html/wp-includes/class-wp-hook.php(309): pmpro_courses_plugin_action_links()
#2 /home/x/public_html/wp-includes/plugin.php(191): WP_Hook->apply_filters()
#3 /home/x/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/modules/class-callables.php(380): apply_filters()
#4 /home/x/public_html/wp-includes/class-wp-hook.php(307): Automattic\Jetpack\Sync\Modules\Callables->set_plugin_action_links()
#5 /home/x/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#6 /home/x/public_html/wp-includes/plugin.php(476): WP_Hook->do_action()
#7 /home/x/public_html/wp-admin/includes/class-wp-screen.php(422): do_action()
#8 /home/x/public_html/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen()
#9 /home/x/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(471): set_current_screen()
#10 /home/x/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(567): Automattic\Jetpack\Sync\Sender->get_items_to_send()
#11 /home/x/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(428): Automattic\Jetpack\Sync\Sender->do_sync_for_queue()
#12 /home/x/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-sender.php(370): Automattic\Jetpack\Sync\Sender->do_sync_and_set_delays()
#13 /home/x/public_html/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-actions.php(191): Automattic\Jetpack\Sync\Sender->do_dedicated_sync_and_exit()
#14 /home/x/public_html/wp-includes/class-wp-hook.php(307): Automattic\Jetpack\Sync\Actions::add_dedicated_sync_sender_init()
#15 /home/x/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#16 /home/x/public_html/wp-includes/plugin.php(476): WP_Hook->do_action()
#17 /home/x/public_html/wp-settings.php(598): do_action()
#18 /home/x/public_html/wp-config.php(111): require_once(‘/home/x…’)
#19 /home/x/public_html/wp-load.php(50): require_once(‘/home/x…’)
#20 /home/x/public_html/wp-blog-header.php(13): require_once(‘/home/x…’)
#21 /home/x/public_html/index.php(17): require(‘/home/x…’)
#22 {main}
thrown

Customer said:

Thus far it has only manifested as an email to me. I have not seen anything untoward on my screen or on my website.

Expected behavior
There should not be an error.

Isolating the problem:

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

This came up in ticket 441951 and I can replicate it.

WordPress Environment

``` Paid Memberships Pro 2.9.3, Courses for Membership Add On 1.1, WordPress 6.0.1, PHP 8.1.8 and 8.2 ```

Drag and drop lesson reordering in the metabox on edit course screen.

Is your feature request related to a problem? Please describe.
Reordering course lessons is a challenge. There has to be a nicer way people can do this over the numerical method we have now.

Describe the solution you'd like
Let's add drag and drop lesson reordering in the metabox or some other course organizer screen.

Describe alternatives you've considered
An alternative is do nothing and keep it as is.

Additional context
See also my issue #58 for course sections which could have implications here if you are reordering sections + lessons + moving things between sections.

Add Blocks

Let's add blocks for each of the shortcodes included: all courses, my courses.

Pagination on lessons pages is not consistent.

Describe the bug
If Lessons are created "out of order" or rearranged, pagination does not appear to recognize the change.
The lessons display correctly on the course page, but the pagination at the bottom of the lesson is off or stops working.

To Reproduce
Steps to reproduce the behavior:

  1. Create Course
  2. Create Lessons
  3. Attach Lessons to the course, but not in the order they were created
  4. Go to a Lesson and follow Pagination Links.

Screenshots
https://capture.dropbox.com/IMVGtBBJbTp0FST2

Expected behavior
Pagination should match the Lesson order as set up on the Course Page.

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

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

WordPress Environment
WordPress 6.4.3
PMPro 3.0.1
Courses for Membership Add On - 1.2.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.