Skip to content

Commit c5c0b8a

Browse files
authored
Merge pull request #7869 from Automattic/fix/course-structure-exposing-lesson-initial-content
Fix course structure API exposing the lesson AI generated bootstrap text
2 parents 015c8e9 + 24190e8 commit c5c0b8a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Fix the course structure API exposing the lesson AI generated bootstrap text

includes/class-sensei-course-structure.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ private function prepare_lesson( WP_Post $lesson_post ): array {
187187
'title' => $lesson_post->post_title,
188188
'draft' => 'draft' === $lesson_post->post_status,
189189
'preview' => Sensei_Utils::is_preview_lesson( $lesson_post->ID ),
190-
'initialContent' => get_post_meta( $lesson_post->ID, '_initial_content', true ),
190+
'initialContent' => current_user_can( 'edit_lesson', $lesson_post->ID )
191+
? get_post_meta( $lesson_post->ID, '_initial_content', true )
192+
: '',
191193
];
192194
}
193195

phpcs.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
<element value="manage_sensei_grades"/>
8888
<element value="edit_course"/>
8989
<element value="edit_courses"/>
90+
<element value="edit_lesson"/>
91+
<element value="edit_lessons"/>
9092
<element value="edit_published_lessons"/>
9193
</property>
9294
</properties>

0 commit comments

Comments
 (0)