Changeset 2389243
- Timestamp:
- 09/27/2020 07:19:48 PM (5 years ago)
- Location:
- wp-courses/trunk
- Files:
-
- 4 edited
-
README.md (modified) (1 diff)
-
wp-courses.php (modified) (7 diffs)
-
wp-courses.pot (modified) (6 diffs)
-
wpc-options.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-courses/trunk/README.md
r2388997 r2389243 5 5 Requires at least: 4.6 6 6 Tested up to: 5.5.1 7 Stable tag: 2.0.2 87 Stable tag: 2.0.29 8 8 License: GPLv2 or later license 9 9 -
wp-courses/trunk/wp-courses.php
r2388997 r2389243 3 3 * Plugin Name: WP Courses LMS 4 4 * Description: WP Courses is a free learning management system (LMS) plugin for WordPress. It includes a rich feature set that allows you to create unlimited courses, restrict content and much more. 5 * Version: 2.0.2 85 * Version: 2.0.29 6 6 * Author: Myles English 7 7 * Plugin URI: https://wpcoursesplugin.com … … 295 295 // Register Custom Post Type Course 296 296 function wpc_register_course_cp(){ 297 297 298 $labels = array( 298 299 'name' => _x( 'Courses', 'post type general name'), … … 326 327 'supports' => array('title', 'editor', 'excerpt', 'page-attributes', 'thumbnail', 'custom-fields'), 327 328 'has_archive' => true, 328 'show_in_rest' => false, 329 ); 330 331 $wpc_enable_rest_course = get_option( 'wpc_enable_rest_course' ); 332 333 if( $wpc_enable_rest_course == 'true' ){ 334 $args['show_in_rest'] = true; 335 } 329 'show_in_rest' => true, 330 ); 336 331 337 332 register_post_type('course', $args); … … 393 388 'public' => true, 394 389 'show_ui' => true, 395 'show_in_rest' => false,390 'show_in_rest' => true, 396 391 'labels' => $labels, 397 392 'description' => __('Enter a lesson description here', 'wp-courses'), … … 399 394 ); 400 395 401 $wpc_enable_rest_lesson = get_option('wpc_enable_rest_lesson');402 403 if( $wpc_enable_rest_lesson == 'true' ){404 $args['show_in_rest'] = true;405 }406 407 396 register_post_type( 'lesson', $args ); 408 397 flush_rewrite_rules( false ); 409 398 } 410 399 add_action( 'init', 'wpc_register_lesson_cp' ); 400 401 function wpc_remove_lesson_rest_api_data( $data, $post, $context ) { 402 403 $can_edit = current_user_can( 'edit_posts' ); 404 405 if ( $can_edit != true ) { 406 407 $wpc_enable_rest_lesson = get_option( 'wpc_enable_rest_lesson' ); 408 409 if( $wpc_enable_rest_lesson != 'true' ){ 410 unset ($data->data ['content']); 411 unset ($data->data ['excerpt']); 412 } 413 } 414 415 return $data; 416 417 } 418 419 add_filter( 'rest_prepare_lesson', 'wpc_remove_lesson_rest_api_data', 12, 3 ); 420 411 421 //Custom Messages for Custom Post Type Lesson 412 422 function wpc_lesson_messages_cp( $messages ) { … … 464 474 'public' => true, 465 475 'show_ui' => true, 466 'show_in_rest' => false,476 'show_in_rest' => true, 467 477 'labels' => $labels, 468 478 'description' => __('Enter a module description here', 'wp-courses'), 469 479 'supports' => array( 'title' ), 470 480 ); 471 472 $wpc_enable_rest_lesson = get_option('wpc_enable_rest_lesson');473 474 if( $wpc_enable_rest_lesson == 'true' ){475 $args['show_in_rest'] = true;476 }477 481 478 482 register_post_type( 'wpc-module', $args ); … … 533 537 'public' => true, 534 538 'show_ui' => true, 535 'show_in_rest' => false,539 'show_in_rest' => true, 536 540 'labels' => $labels, 537 541 'description' => __('Enter a Teacher Description Here', 'wp-courses'), 538 542 'supports' => array('title', 'editor', 'excerpt', 'page-attributes', 'thumbnail'), 539 543 ); 540 541 $wpc_enable_rest_teacher = get_option('wpc_enable_rest_teacher');542 543 if( $wpc_enable_rest_teacher == 'true' ){544 $args['show_in_rest'] = true;545 }546 544 547 545 register_post_type('teacher', $args); -
wp-courses/trunk/wp-courses.pot
r2388997 r2389243 4 4 "Project-Id-Version: WP Courses LMS\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 2020-09-2 6 21:56+0000\n"6 "POT-Creation-Date: 2020-09-27 19:18+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 158 158 msgstr "" 159 159 160 #: admin-nav-menu.php:11 wp-courses.php:31 0160 #: admin-nav-menu.php:11 wp-courses.php:311 161 161 msgid "Courses" 162 162 msgstr "" … … 183 183 msgstr "" 184 184 185 #: wp-courses.php:32 2185 #: wp-courses.php:323 186 186 msgid "Enter a Course Description Here" 187 187 msgstr "" 188 188 189 #: wp-courses.php:39 7189 #: wp-courses.php:392 190 190 msgid "Enter a lesson description here" 191 191 msgstr "" 192 192 193 #: wp-courses.php:4 68193 #: wp-courses.php:478 194 194 msgid "Enter a module description here" 195 195 msgstr "" 196 196 197 #: wp-courses.php:5 37197 #: wp-courses.php:541 198 198 msgid "Enter a Teacher Description Here" 199 199 msgstr "" … … 248 248 msgstr "" 249 249 250 #: wp-courses.php:37 8250 #: wp-courses.php:373 251 251 msgid "Lessons" 252 252 msgstr "" … … 280 280 msgstr "" 281 281 282 #: wp-courses.php:4 48282 #: wp-courses.php:458 283 283 msgid "Modules" 284 284 msgstr "" … … 414 414 msgstr "" 415 415 416 #: admin-nav-menu.php:29 wp-courses.php:5 19416 #: admin-nav-menu.php:29 wp-courses.php:523 417 417 msgid "Teachers" 418 418 msgstr "" -
wp-courses/trunk/wpc-options.php
r2388997 r2389243 3 3 function wpc_register_settings() { 4 4 5 add_option( 'wpc_enable_rest_course', 'false');6 5 add_option( 'wpc_enable_rest_lesson', 'false'); 7 add_option( 'wpc_enable_rest_teacher', 'false');8 6 9 7 add_option( 'wpc_show_breadcrumb_trail', 'true'); … … 29 27 add_option( 'wpc_primary_button_active_text_color', '#fff'); 30 28 31 // register_setting( 'wpc_options', 'wpc_profile_page', 'wpc_callback' );32 // register_setting( 'wpc_options', 'wpc_course_page', 'wpc_callback' );33 34 register_setting( 'wpc_options', 'wpc_enable_rest_course', 'wpc_callback' );35 29 register_setting( 'wpc_options', 'wpc_enable_rest_lesson', 'wpc_callback' ); 36 register_setting( 'wpc_options', 'wpc_enable_rest_teacher', 'wpc_callback' );37 30 38 31 register_setting( 'wpc_options', 'wpc_show_breadcrumb_trail', 'wpc_callback' ); … … 72 65 settings_fields( 'wpc_options' ); 73 66 74 $wpc_enable_rest_course = get_option('wpc_enable_rest_course');75 67 $wpc_enable_rest_lesson = get_option('wpc_enable_rest_lesson'); 76 $wpc_enable_rest_teacher = get_option('wpc_enable_rest_teacher');77 68 78 69 $wpc_show_breadcrumb_trail = get_option('wpc_show_breadcrumb_trail'); … … 100 91 $id = get_the_ID(); 101 92 102 if( $wpc_enable_rest_course == 'true' ){103 $rest_course_checked = 'checked';104 } else {105 $rest_course_checked = '';106 }107 108 93 if( $wpc_enable_rest_lesson == 'true' ){ 109 94 $rest_lesson_checked = 'checked'; … … 112 97 } 113 98 114 if( $wpc_enable_rest_teacher == 'true' ){115 $rest_teacher_checked = 'checked';116 } else {117 $rest_teacher_checked = '';118 }119 120 99 if($wpc_show_breadcrumb_trail == 'true'){ 121 100 $breadcrumb_checked = 'checked'; … … 151 130 152 131 <div class="wpc-option"> 153 <input type="checkbox" id="wpc-enable-lesson-rest" name="wpc_enable_rest_lesson" value="true" <?php echo $rest_lesson_checked; ?>/><label for="wpc-enable-lesson-rest">Enable REST API for Lessons and Modules. <b>Warning!</b> If checked, restricted lesson content is accessable <b>TO ANYONE</b> via the REST API.</label> 154 </div> 155 156 <div class="wpc-option"> 157 <input type="checkbox" id="wpc-enable-course-rest" name="wpc_enable_rest_course" value="true" <?php echo $rest_course_checked; ?>/><label for="wpc-enable-course-rest">Enable REST API for Courses</label> 158 </div> 159 160 <div class="wpc-option"> 161 <input type="checkbox" id="wpc-enable-teacher-rest" name="wpc_enable_rest_teacher" value="true" <?php echo $rest_teacher_checked; ?>/><label for="wpc-enable-teacher-rest">Enable REST API for Teachers</label> 132 <input type="checkbox" id="wpc-enable-lesson-rest" name="wpc_enable_rest_lesson" value="true" <?php echo $rest_lesson_checked; ?>/><label for="wpc-enable-lesson-rest">Show lesson content in the REST API. <b>Warning!</b> If checked, restricted lesson content is accessable <b>TO ANYONE</b> via the REST API.</label> 162 133 </div> 163 134
Note: See TracChangeset
for help on using the changeset viewer.