Skip to content

Commit e3ef194

Browse files
authored
Merge pull request #7619 from Automattic/release/4.24.1
Release/4.24.1
2 parents e0f34bf + 08f7082 commit e3ef194

14 files changed

+114
-107
lines changed

changelog.txt

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
*** Changelog ***
22

3+
## 4.24.1 - 2024-06-13
4+
### Security
5+
- Improve security for lessons and modules ordering
6+
7+
### Fixed
8+
- Avoid creating a new translation if it exists already [#7609](https://github.com/Automattic/sensei/pull/7609)
9+
- Change some taxonomy capabilities to fix some behaviors [#7613](https://github.com/Automattic/sensei/pull/7613)
10+
- Contact teacher form not displaying correctly in Learning Mode [#7610](https://github.com/Automattic/sensei/pull/7610)
11+
- Register Sensei LMS custom post types without delay [#7607](https://github.com/Automattic/sensei/pull/7607)
12+
- Support "0" or other falsy values as an answer for a quiz question [#7614](https://github.com/Automattic/sensei/pull/7614)
13+
314
## 4.24.0 - 2024-04-25
415
### Security
516
- Prevent unauthenticated flushing of rewrite rules [#7596](https://github.com/Automattic/sensei/pull/7596)

changelog/fix-capability-issue

-4
This file was deleted.

changelog/fix-contact-teacher-block-in-learning-mode

-4
This file was deleted.

changelog/fix-quiz-questions-with-falsy-answers

-4
This file was deleted.

changelog/fix-wpml-slug-translation

-4
This file was deleted.

changelog/fix-wpml-translate-updated-content

-4
This file was deleted.

includes/class-sensei-admin.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -1248,12 +1248,18 @@ public function save_course_order( $order_string = '' ) {
12481248
*/
12491249
public function handle_order_lessons() {
12501250
check_admin_referer( 'order_lessons' );
1251-
if ( ! current_user_can( 'edit_published_lessons' ) ) {
1251+
1252+
$course_id = isset( $_POST['course_id'] ) ? intval( $_POST['course_id'] ) : 0;
1253+
1254+
if (
1255+
! current_user_can( 'edit_published_lessons' )
1256+
|| ! Sensei_Course::can_current_user_edit_course( $course_id )
1257+
) {
12521258
wp_die( esc_html__( 'Insufficient permissions', 'sensei-lms' ) );
12531259
}
12541260

12551261
if (
1256-
empty( $_POST['course_id'] )
1262+
empty( $course_id )
12571263
|| empty( $_POST['lessons'] )
12581264
) {
12591265
_doing_it_wrong(
@@ -1273,8 +1279,7 @@ public function handle_order_lessons() {
12731279
];
12741280
}
12751281

1276-
$course_id = (int) $_POST['course_id'];
1277-
$ordered = $this->sync_lesson_order(
1282+
$ordered = $this->sync_lesson_order(
12781283
$lessons_order,
12791284
$course_id
12801285
);

includes/class-sensei-modules.php

+14-5
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ public function add_submenus() {
12611261
'', // Hide the submenu.
12621262
__( 'Order Modules', 'sensei-lms' ),
12631263
__( 'Order Modules', 'sensei-lms' ),
1264-
'edit_lessons',
1264+
'edit_courses',
12651265
$this->order_page_slug,
12661266
array( $this, 'module_order_screen' )
12671267
);
@@ -1275,18 +1275,27 @@ public function add_submenus() {
12751275
public function handle_order_modules() {
12761276
check_admin_referer( 'order_modules' );
12771277

1278+
$course_id = isset( $_POST['course_id'] ) ? intval( $_POST['course_id'] ) : 0;
1279+
$module_order = isset( $_POST['module-order'] ) ? sanitize_text_field( wp_unslash( $_POST['module-order'] ) ) : '';
1280+
1281+
if (
1282+
! Sensei_Course::can_current_user_edit_course( $course_id )
1283+
) {
1284+
wp_die( esc_html__( 'Insufficient permissions', 'sensei-lms' ) );
1285+
}
1286+
12781287
$ordered = false;
1279-
if ( isset( $_POST['module-order'] ) && 0 < strlen( $_POST['module-order'] ) ) {
1280-
$ordered = $this->save_course_module_order( esc_attr( $_POST['module-order'] ), esc_attr( $_POST['course_id'] ) );
1288+
if ( 0 < strlen( $module_order ) ) {
1289+
$ordered = $this->save_course_module_order( esc_attr( $module_order ), $course_id );
12811290
}
12821291

1283-
wp_redirect(
1292+
wp_safe_redirect(
12841293
esc_url_raw(
12851294
add_query_arg(
12861295
array(
12871296
'page' => $this->order_page_slug,
12881297
'ordered' => $ordered,
1289-
'course_id' => $_POST['course_id'],
1298+
'course_id' => $course_id,
12901299
),
12911300
admin_url( 'admin.php' )
12921301
)

0 commit comments

Comments
 (0)