Add first lesson url placeholder to Welcome to Course email - #8127
Draft
faisalahammad wants to merge 6 commits into
Draft
Add first lesson url placeholder to Welcome to Course email#8127faisalahammad wants to merge 6 commits into
faisalahammad wants to merge 6 commits into
Conversation
- Add course:first_lesson_url replacement in the Course_Welcome generator, falling back to the course URL when the course has no published lessons. - Use the placeholder for the Start Course link in the welcome email pattern. - Include the placeholder in the email preview placeholder list. - Update the Course_Welcome tests. Fixes Automattic#8076
The WPML copy test asserts the full replacements array, which now includes the course:first_lesson_url key (falling back to the course URL).
The first lesson url now follows the lesson order saved on the course page (_lesson_order meta) when present, instead of only the course_lessons order, so the welcome email links match what students see on the course page. Adds a test covering the custom order.
Adds a changelog entry for the new course:first_lesson_url placeholder in the Welcome to Course email.
- Format the test file per WP coding standards (short arrays to array(), realign `=>`/`=`). - Coalesce course and first-lesson permalinks to definite strings before passing to esc_url() (Psalm 104). - Guard against a falsy course_lessons() result with empty() instead of an is_array() check (Psalm 155 docblock contradiction). - Narrow the WP_Post|int union from course_lessons() before casting to int in get_first_lesson_id() (Psalm 103).
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.
Resolves #8076
Proposed Changes
The Welcome to Course email links new students only to the generic course page, and instructors can't hardcode a lesson URL that would be correct for every course. This change lets the email point students straight at the course's starting point.
[course:first_lesson_url]placeholder to the Welcome to Course email that resolves to the permalink of the course's first published lesson.[course:url]._lesson_order, the drag-and-drop order on the course page) when present.Existing installs keep their user-customized email content (emails are editable content and are not rewritten on upgrade); the new button appears on fresh installs and after using the "Recreate Emails" tool.
Testing Instructions
[course:first_lesson_url]placeholder.New/Updated Hooks
No hooks added or changed.
Deprecated Code
No code deprecated.
Changelog entry
Welcome to Course email now links the Start Course button to the first lesson with a new first lesson placeholder, so new students go straight to where learning begins.