Conversation
| * Inserter: no | ||
| */ | ||
|
|
||
| $course_id = isset( $_GET['course_id'] ) ? intval( $_GET['course_id'] ) : get_the_ID(); |
There was a problem hiding this comment.
Curious about this, did you find a case where get_the_ID() didn't work? I would have thought that would be the ideal means for getting it.
There was a problem hiding this comment.
I haven’t encountered this, but I remember being reminded before that in certain places like before/after the loop or in header, footer, or admin pages, get_the_ID() might not work, as it’s likely to return no value in those contexts. It works here because I saw this snippet from the post_template block.
| const link = postMetaData?._course_completion_survey_link || ''; | ||
|
|
||
| return ( | ||
| <PluginDocumentSettingPanel title={ __( 'Course Completion Settings', 'wporg-learn' ) }> |
There was a problem hiding this comment.
Given this is displayed on the course edit screen in the settings panel I think we can simplify the text a bit, how about
| <PluginDocumentSettingPanel title={ __( 'Course Completion Settings', 'wporg-learn' ) }> | |
| <PluginDocumentSettingPanel title={ __( 'Completed screen', 'wporg-learn' ) }> |
| <p>{ __( 'If the fields are left blank, the default values will be applied.', 'wporg-learn' ) }</p> | ||
| </PanelRow> | ||
| <PanelRow> | ||
| <TextControl |
There was a problem hiding this comment.
Can we show a placeholder value here 'Congratulations on completing this course!'?
There was a problem hiding this comment.
Personally I don't have a problem with it being cut off; I think it still provides an example of what is expected. If we did want to shorten it I'd just use Congratulations!, as it's still close to the default.
There was a problem hiding this comment.
I think it still provides an example of what is expected.
This makes sense to me. 16df720
| return ( | ||
| <PluginDocumentSettingPanel title={ __( 'Course Completion Settings', 'wporg-learn' ) }> | ||
| <PanelRow> | ||
| <p>{ __( 'If the fields are left blank, the default values will be applied.', 'wporg-learn' ) }</p> |
There was a problem hiding this comment.
| <p>{ __( 'If the fields are left blank, the default values will be applied.', 'wporg-learn' ) }</p> | |
| <p>{ __( 'These fields customize what is displayed on the Course Completed screen. If left blank, the default values will be applied.', 'wporg-learn' ) }</p> |
adamwoodnz
left a comment
There was a problem hiding this comment.
Nice work! A few suggestions inline.
| } | ||
|
|
||
| /** | ||
| * Register post meta keys for lessons. |
There was a problem hiding this comment.
| * Register post meta keys for lessons. | |
| * Register post meta keys for courses. |


Resolves #2564
This PR adds two fields to the Gutenberg editor sidebar, allowing users to enter a custom success message and survey link.
Screenshots
Update
description added