fix(notifications): add unenrollment notification trigger#3185
Open
faisalahammad wants to merge 1 commit into
Open
fix(notifications): add unenrollment notification trigger#3185faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
Adds a new 'unenrollment' notification that fires when a student is removed
from a course or membership. Supports popup (basic) and email delivery, with
all subscribers disabled by default per the feature request.
- New controller listens to llms_user_removed_from_course and
llms_user_removed_from_membership (the post 6.0.0 hooks).
- New view defines {{TITLE}}, {{TYPE}}, and {{STUDENT_NAME}} merge codes
with a negative icon variant.
- Register 'unenrollment' trigger in LLMS_Notifications::load().
- All subscribers default to 'no' so existing sites are not opted in.
Fixes gocodebox#3141
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
unenrollmentnotification trigger that fires when a student is removed from a course or membership. Supports both popup (basic) and email delivery, with all subscribers disabled by default so existing sites are not opted in.Fixes #3141
Changes
includes/notifications/controllers/class.llms.notification.controller.unenrollment.php(new)Before: no controller existed for the unenrollment event.
After:
Why: mirrors the existing
enrollmentcontroller pattern so admins configure one notification for both post types. Usesllms_user_removed_from_membershiprather than the_levelform (the_levelhook was removed in 6.0.0). Accepts 4 args because the unenrollment action passes$user_id, $post_id, $trigger, $new_status.includes/notifications/views/class.llms.notification.view.unenrollment.php(new)Before: no view existed for the unenrollment event.
After:
Why: same merge-code and formatting conventions as the
enrollmentview. Negative icon visually signals removal. The popup auto-dismisses and is manually dismissible like the rest of the basic notifications.includes/notifications/class.llms.notifications.phpBefore:
$triggersarray ended withsubscription_cancelledfollowed byupcoming_payment_reminder.After:
'unenrollment'inserted between them to keep alphabetical order.Why: the loader pulls the controller and view from their conventional paths once the trigger is registered, so no other registration is needed.
.changelogs/issue-3141.yml(new)Why: the project's changelog tooling only picks up files ending in
.yml; this matches the contribution workflow.Testing
Test 1: registration
Result: Works as expected.
Test 2: defaults disabled
Result: Works as expected.
Test 3: course unenrollment
Result: popup appears with the course title and the negative icon; the student receives the email.
Test 4: membership unenrollment
Result: same popup and email behavior, with
{{TYPE}}resolving to "Membership".Test 5: silent on hard delete
llms_delete_student_enrollment()which fires thellms_user_enrollment_deletedhook (not the unenrollment hook).Result: no notification is sent.