PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.10
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.10
4.4.10 4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 All 142 releases
← All changes | inc/TemplateHooks/CourseBuilder/Quiz/BuilderEditQuizTemplate.php +15 -4 4.3.7 → 4.4.10 View file →
@@ -51,11 +51,11 @@
51 51 if ( empty( $item_id ) ) {
52 52 throw new Exception( __( 'Invalid quiz ID', 'learnpress' ) );
53 53 }
54 54
55 - if ( ! CourseBuilderAccessPolicy::can_access_tab_post( 'quizzes', $item_id ) ) {
55 + /*if ( ! CourseBuilderAccessPolicy::can_access_tab_post( 'quizzes', $item_id ) ) {
56 56 throw new Exception( __( "Sorry, you don't have permission to access this content", 'learnpress' ) );
57 - }
57 + }*/
58 58
59 59 $is_create_new = $item_id === CourseBuilder::POST_NEW;
60 60 $quizModel = false;
61 61
@@ -64,8 +64,10 @@
64 64 if ( ! $quizModel ) {
65 65 throw new Exception( __( 'Quiz not found', 'learnpress' ) );
66 66 }
67 67
68 + $quizModel->check_capabilities_update_item_course();
69 +
68 70 if ( $quizModel->post_status === PostModel::STATUS_TRASH ) {
69 71 throw new Exception(
70 72 __(
71 73 'You cannot edit this item because it is in the Trash. Please restore it and try again.',
@@ -72,8 +74,11 @@
72 74 'learnpress'
73 75 )
74 76 );
75 77 }
78 + } else {
79 + $quizModelNew = new QuizPostModel();
80 + $quizModelNew->check_capabilities_create_item_course();
76 81 }
77 82
78 83 $data['quizModel'] = $quizModel;
79 84
@@ -420,9 +425,9 @@
420 425 $title = ! empty( $quiz_model ) ? $quiz_model->get_the_title() : '';
421 426 $edit = [
422 427 'wrapper' => '<div class="cb-quiz-edit-title">',
423 428 'label' => sprintf( '<label for="title" class="cb-quiz-edit-title__label">%s</label>', __( 'Title', 'learnpress' ) ),
424 - 'input' => sprintf( '<input type="text" name="quiz_title" size="30" value="%s" id="title" class="cb-quiz-edit-title__input">', $title ),
429 + 'input' => sprintf( '<input type="text" name="quiz_title" size="30" value="%s" id="title" class="cb-quiz-edit-title__input">', esc_attr( $title ) ),
425 430 'wrapper_end' => '</div>',
426 431 ];
427 432
428 433 return Template::combine_components( $edit );
@@ -427,10 +432,16 @@
427 432
428 433 return Template::combine_components( $edit );
429 434 }
430 435
436 + /**
437 + * Edit description
438 + *
439 + * @param QuizPostModel|false $quiz_model
440 + * @return string
441 + */
431 442 public function edit_desc( $quiz_model ) {
432 - $desc = ! empty( $quiz_model ) ? $quiz_model->get_the_content() : '';
443 + $desc = ! empty( $quiz_model ) ? $quiz_model->post_content : '';
433 444 $editor_id = 'quiz_description_editor';
434 445 $editor_settings = array(
435 446 'textarea_name' => 'quiz_description',
436 447 'textarea_rows' => 10,