Feature: "Any" option for engagement trigger posts#3109
Open
flintfromthebasement wants to merge 1 commit intogocodebox:devfrom
Open
Feature: "Any" option for engagement trigger posts#3109flintfromthebasement wants to merge 1 commit intogocodebox:devfrom
flintfromthebasement wants to merge 1 commit intogocodebox:devfrom
Conversation
Allow engagements to fire for any course, membership, lesson, quiz, section, access plan, or course track — not just a specific one. When the trigger post select field is left blank, the value 'any' is stored in _llms_engagement_trigger_post. The engagement query matches both specific post IDs and the 'any' sentinel value. Uses an explicit 'any' value rather than treating empty/zero as a wildcard, so existing engagements with accidentally empty trigger posts are not affected.
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
How It Works
Admin UI: The trigger post select fields (e.g., "Select a Course") can now be cleared. When cleared, the placeholder reads "Any Course" (or "Any Membership", etc.), and a help text says "Leave blank to apply to all."
Storage: An empty selection saves the literal string
'any'in_llms_engagement_trigger_post. This is an explicit opt-in — we intentionally avoided treating empty/zero values as wildcards so that existing engagements with accidentally blank trigger posts don't suddenly fire on everything.Query: The engagement matching SQL adds
OR relation_meta.meta_value = 'any'alongside the specific post ID match, so both targeted and wildcard engagements are returned.List table: The engagements admin list shows "Any" in italics for wildcard engagements.
Design Decision: Explicit
'any'vs Empty-Means-AnyWe considered treating empty or
0values as "any" but rejected it because:'any') makes the intent clear in the databaseFiles Changed
class.llms.engagements.php'any'class.llms.meta.box.engagement.php'any'), description textclass.llms.admin.post.table.engagements.phpDuplicate/Spam Safety
dupcheck()uses the actual related post ID (the course the student enrolled in), not the engagement's trigger post config. So an "any course" achievement is awarded once per course — not re-awarded for the same course.Test Plan