PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
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 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/TemplateHooks/CourseBuilder/Question/BuilderEditQuestionTemplate.php +13 -4 4.3.74.4.8 View file →
@@ -51,11 +51,11 @@
51 51 if ( empty( $item_id ) ) {
52 52 throw new Exception( __( 'Invalid question ID', 'learnpress' ) );
53 53 }
54 54
55 - if ( ! CourseBuilderAccessPolicy::can_access_tab_post( 'questions', $item_id ) ) {
55 + /*if ( ! CourseBuilderAccessPolicy::can_access_tab_post( 'questions', $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 $questionModel = false;
61 61
@@ -64,8 +64,10 @@
64 64 if ( ! $questionModel ) {
65 65 throw new Exception( __( 'Question not found', 'learnpress' ) );
66 66 }
67 67
68 + $questionModel->check_capabilities_update_item_course();
69 +
68 70 if ( $questionModel->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 + $questionModelNew = new QuestionPostModel();
80 + $questionModelNew->check_capabilities_create_item_course();
76 81 }
77 82
78 83 $data['questionModel'] = $questionModel;
79 84
@@ -376,9 +381,9 @@
376 381 $title = ! empty( $question_model ) ? $question_model->get_the_title() : '';
377 382 $edit = [
378 383 'wrapper' => '<div class="cb-question-edit-title">',
379 384 'label' => sprintf( '<label for="title" class="cb-question-edit-title__label">%s</label>', __( 'Title', 'learnpress' ) ),
380 - 'input' => sprintf( '<input type="text" name="question_title" size="30" value="%s" id="title" class="cb-question-edit-title__input">', $title ),
385 + 'input' => sprintf( '<input type="text" name="question_title" size="30" value="%s" id="title" class="cb-question-edit-title__input">', esc_attr( $title ) ),
381 386 'wrapper_end' => '</div>',
382 387 ];
383 388
384 389 return Template::combine_components( $edit );
@@ -383,10 +388,14 @@
383 388
384 389 return Template::combine_components( $edit );
385 390 }
386 391
392 + /**
393 + * @param QuestionPostModel|false $question_model
394 + * @return string
395 + */
387 396 public function edit_desc( $question_model ) {
388 - $desc = ! empty( $question_model ) ? $question_model->get_the_content() : '';
397 + $desc = ! empty( $question_model ) ? $question_model->post_content : '';
389 398 $editor_id = 'question_description_editor';
390 399 $editor_settings = array(
391 400 'textarea_name' => 'question_description',
392 401 'textarea_rows' => 10,