PluginProbe ʕ •ᴥ•ʔ
Tutor LMS – eLearning and online course solution / 4.0.4
Tutor LMS – eLearning and online course solution v4.0.4
4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.11 1.2.12 1.2.13 1.2.20 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.15 1.9.16 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / classes / Post_types.php
tutor / classes Last commit date
Addons.php 1 month ago Admin.php 3 weeks ago Ajax.php 1 month ago Announcements.php 1 month ago Assets.php 1 week ago Backend_Page_Trait.php 1 year ago BaseController.php 1 year ago Config.php 1 month ago Container.php 1 year ago Course.php 1 month ago Course_Embed.php 3 years ago Course_Filter.php 1 month ago Course_List.php 1 month ago Course_Settings_Tabs.php 1 month ago Course_Widget.php 1 year ago Custom_Validation.php 1 month ago Dashboard.php 1 month ago Earnings.php 10 months ago FormHandler.php 1 month ago Frontend.php 1 month ago Gutenberg.php 1 year ago Icon.php 3 weeks ago Input.php 1 month ago Instructor.php 1 month ago Instructors_List.php 1 month ago Lesson.php 1 month ago Options_V2.php 1 month ago Permalink.php 1 month ago Post_types.php 1 month ago Private_Course_Access.php 1 month ago Q_And_A.php 1 month ago Question_Answers_List.php 1 year ago Quiz.php 3 weeks ago QuizBuilder.php 1 month ago Quiz_Attempts_List.php 1 month ago RestAPI.php 1 month ago Reviews.php 1 month ago Rewrite_Rules.php 2 years ago SampleCourse.php 1 month ago Shortcode.php 1 month ago Singleton.php 1 year ago Student.php 1 month ago Students_List.php 1 year ago Taxonomies.php 1 year ago Template.php 1 month ago Theme_Compatibility.php 3 years ago Tools.php 1 year ago Tools_V2.php 2 months ago Tutor.php 1 month ago TutorEDD.php 1 month ago Tutor_Base.php 2 years ago Tutor_Setup.php 1 month ago Upgrader.php 1 month ago User.php 1 week ago UserPreference.php 1 month ago Utils.php 3 weeks ago Video_Stream.php 3 years ago WhatsNew.php 1 month ago Withdraw.php 1 month ago Withdraw_Requests_List.php 1 year ago WooCommerce.php 1 month ago
Post_types.php
526 lines
1 <?php
2 /**
3 * Register post types
4 *
5 * @package Tutor\PostTypes
6 * @category PostTypes
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.0.0
10 */
11
12 namespace TUTOR;
13
14 use Tutor\Models\CourseModel;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19 /**
20 * Register Tutor's post types
21 *
22 * @since 1.0.0
23 */
24 //phpcs:ignore
25 class Post_types {
26
27 /**
28 * Course post type
29 *
30 * @since 1.0.0
31 *
32 * @var string
33 */
34 public $course_post_type;
35
36 /**
37 * Lesson post type
38 *
39 * @since 1.0.0
40 *
41 * @var string
42 */
43 public $lesson_post_type;
44
45 /**
46 * Register hooks
47 *
48 * @since 1.0.0
49 */
50 public function __construct() {
51 $this->course_post_type = tutor()->course_post_type;
52 $this->lesson_post_type = tutor()->lesson_post_type;
53
54 add_action( 'init', array( $this, 'register_course_post_types' ) );
55 add_action( 'init', array( $this, 'register_lesson_post_types' ) );
56 add_action( 'init', array( $this, 'register_quiz_post_types' ) );
57 add_action( 'init', array( $this, 'register_topic_post_types' ) );
58 add_action( 'init', array( $this, 'register_assignments_post_types' ) );
59
60 add_filter( 'gutenberg_can_edit_post_type', array( $this, 'gutenberg_can_edit_post_type' ), 10, 2 );
61 add_filter( 'use_block_editor_for_post_type', array( $this, 'gutenberg_can_edit_post_type' ), 10, 2 );
62
63 /**
64 * Customize the message of course
65 */
66 add_filter( 'post_updated_messages', array( $this, 'course_updated_messages' ) );
67
68 /**
69 * Since 1.4.0
70 */
71 add_action( 'init', array( $this, 'register_tutor_enrolled_post_types' ) );
72
73 /**
74 * Remove tutor course post type from admin menu
75 *
76 * @since v2.0.0
77 */
78 add_action( 'admin_menu', array( $this, 'remove_course_post_menu' ) );
79 }
80
81 /**
82 * Register course post type
83 *
84 * @since 1.0.0
85 *
86 * @return void
87 */
88 public function register_course_post_types() {
89 $course_post_type = $this->course_post_type;
90
91 $labels = array(
92 'name' => _x( 'Courses', 'post type general name', 'tutor' ),
93 'singular_name' => _x( 'Course', 'post type singular name', 'tutor' ),
94 'menu_name' => _x( 'Courses', 'admin menu', 'tutor' ),
95 'name_admin_bar' => _x( 'Course', 'add new on admin bar', 'tutor' ),
96 'add_new' => _x( 'Add New', 'tutor course add', 'tutor' ),
97 'add_new_item' => __( 'Add New Course', 'tutor' ),
98 'new_item' => __( 'New Course', 'tutor' ),
99 'edit_item' => __( 'Edit Course', 'tutor' ),
100 'view_item' => __( 'View Course', 'tutor' ),
101 'all_items' => __( 'Courses', 'tutor' ),
102 'search_items' => __( 'Search Courses', 'tutor' ),
103 'parent_item_colon' => __( 'Parent Courses:', 'tutor' ),
104 'not_found' => __( 'No courses found.', 'tutor' ),
105 'not_found_in_trash' => __( 'No courses found in Trash.', 'tutor' ),
106 );
107
108 $args = array(
109 'labels' => $labels,
110 'description' => __( 'Description.', 'tutor' ),
111 'public' => true,
112 'publicly_queryable' => true,
113 // 'show_ui' => true,
114 // 'show_in_menu' => 'tutor',
115 'query_var' => true,
116 'rewrite' => array(
117 'slug' => tutor_utils()->get_option( 'course_permalink_base', $course_post_type ),
118 'with_front' => true,
119 ),
120 'menu_icon' => 'dashicons-book-alt',
121 'capability_type' => 'post',
122 'map_meta_cap' => true,
123 'has_archive' => true,
124 'hierarchical' => false,
125 'menu_position' => null,
126 'taxonomies' => array( CourseModel::COURSE_CATEGORY, CourseModel::COURSE_TAG ),
127 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'author' ),
128 'show_in_rest' => true,
129
130 'capabilities' => array(
131 'edit_post' => 'edit_tutor_course',
132 'read_post' => 'read_tutor_course',
133 'delete_post' => 'delete_tutor_course',
134 'delete_posts' => 'delete_tutor_courses',
135 'edit_posts' => 'edit_tutor_courses',
136 'edit_others_posts' => 'edit_others_tutor_courses',
137 'publish_posts' => 'publish_tutor_courses',
138 'read_private_posts' => 'read_private_tutor_courses',
139 'create_posts' => 'edit_tutor_courses',
140 ),
141 );
142
143 register_post_type( $course_post_type, $args );
144
145 /**
146 * Taxonomy
147 */
148 $labels = array(
149 'name' => _x( 'Course Categories', 'taxonomy general name', 'tutor' ),
150 'singular_name' => _x( 'Category', 'taxonomy singular name', 'tutor' ),
151 'search_items' => __( 'Search Categories', 'tutor' ),
152 'popular_items' => __( 'Popular Categories', 'tutor' ),
153 'all_items' => __( 'All Categories', 'tutor' ),
154 'parent_item' => null,
155 'parent_item_colon' => null,
156 'edit_item' => __( 'Edit Category', 'tutor' ),
157 'update_item' => __( 'Update Category', 'tutor' ),
158 'add_new_item' => __( 'Add New Category', 'tutor' ),
159 'new_item_name' => __( 'New Category Name', 'tutor' ),
160 'separate_items_with_commas' => __( 'Separate categories with commas', 'tutor' ),
161 'add_or_remove_items' => __( 'Add or remove categories', 'tutor' ),
162 'choose_from_most_used' => __( 'Choose from the most used categories', 'tutor' ),
163 'not_found' => __( 'No categories found.', 'tutor' ),
164 'menu_name' => __( 'Course Categories', 'tutor' ),
165 );
166
167 $args = array(
168 'hierarchical' => true,
169 'labels' => $labels,
170 'show_ui' => true,
171 'show_admin_column' => true,
172 'update_count_callback' => '_update_post_term_count',
173 'query_var' => true,
174 'show_in_rest' => true,
175 'rewrite' => array( 'slug' => 'course-category' ),
176 );
177
178 register_taxonomy( 'course-category', $this->course_post_type, $args );
179
180 $labels = array(
181 'name' => _x( 'Tags', 'taxonomy general name', 'tutor' ),
182 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'tutor' ),
183 'search_items' => __( 'Search Tags', 'tutor' ),
184 'popular_items' => __( 'Popular Tags', 'tutor' ),
185 'all_items' => __( 'All Tags', 'tutor' ),
186 'parent_item' => null,
187 'parent_item_colon' => null,
188 'edit_item' => __( 'Edit Tag', 'tutor' ),
189 'update_item' => __( 'Update Tag', 'tutor' ),
190 'add_new_item' => __( 'Add New Tag', 'tutor' ),
191 'new_item_name' => __( 'New Tag Name', 'tutor' ),
192 'separate_items_with_commas' => __( 'Separate Tags with commas', 'tutor' ),
193 'add_or_remove_items' => __( 'Add or remove Tags', 'tutor' ),
194 'choose_from_most_used' => __( 'Choose from the most used Tags', 'tutor' ),
195 'not_found' => __( 'No Tags found.', 'tutor' ),
196 'menu_name' => __( 'Tags', 'tutor' ),
197 );
198
199 $args = array(
200 'hierarchical' => false,
201 'labels' => $labels,
202 'show_ui' => true,
203 'show_admin_column' => true,
204 'update_count_callback' => '_update_post_term_count',
205 'query_var' => true,
206 'show_in_rest' => true,
207 'rewrite' => array( 'slug' => 'course-tag' ),
208 );
209
210 register_taxonomy( 'course-tag', $this->course_post_type, $args );
211 }
212
213 /**
214 * Register lesson post type
215 *
216 * @since 1.0.0
217 *
218 * @return void
219 */
220 public function register_lesson_post_types() {
221 $lesson_post_type = $this->lesson_post_type;
222 $lesson_base_slug = apply_filters( 'tutor_lesson_base_slug', $lesson_post_type );
223
224 $labels = array(
225 'name' => _x( 'Lessons', 'post type general name', 'tutor' ),
226 'singular_name' => _x( 'Lesson', 'post type singular name', 'tutor' ),
227 'menu_name' => _x( 'Lessons', 'admin menu', 'tutor' ),
228 'name_admin_bar' => _x( 'Lesson', 'add new on admin bar', 'tutor' ),
229 'add_new' => _x( 'Add New', 'tutor lesson add', 'tutor' ),
230 'add_new_item' => __( 'Add New Lesson', 'tutor' ),
231 'new_item' => __( 'New Lesson', 'tutor' ),
232 'edit_item' => __( 'Edit Lesson', 'tutor' ),
233 'view_item' => __( 'View Lesson', 'tutor' ),
234 'all_items' => __( 'Lessons', 'tutor' ),
235 'search_items' => __( 'Search Lessons', 'tutor' ),
236 'parent_item_colon' => __( 'Parent Lessons:', 'tutor' ),
237 'not_found' => __( 'No lessons found.', 'tutor' ),
238 'not_found_in_trash' => __( 'No lessons found in Trash.', 'tutor' ),
239 );
240
241 $args = array(
242 'labels' => $labels,
243 'description' => __( 'Description.', 'tutor' ),
244 'public' => true,
245 'publicly_queryable' => true,
246 'show_ui' => true,
247 'show_in_menu' => false,
248 'query_var' => true,
249 'rewrite' => array( 'slug' => $lesson_base_slug ),
250 'menu_icon' => 'dashicons-list-view',
251 'capability_type' => 'post',
252 'has_archive' => true,
253 'hierarchical' => false,
254 'menu_position' => null,
255 'supports' => array( 'title', 'editor', 'comments' ),
256 'exclude_from_search' => apply_filters( 'tutor_lesson_exclude_from_search', true ),
257 'capabilities' => array(
258 'edit_post' => 'edit_tutor_lesson',
259 'read_post' => 'read_tutor_lesson',
260 'delete_post' => 'delete_tutor_lesson',
261 'delete_posts' => 'delete_tutor_lessons',
262 'edit_posts' => 'edit_tutor_lessons',
263 'edit_others_posts' => 'edit_others_tutor_lessons',
264 'publish_posts' => 'publish_tutor_lessons',
265 'read_private_posts' => 'read_private_tutor_lessons',
266 'create_posts' => 'edit_tutor_lessons',
267 ),
268 );
269
270 /**
271 * Added for support gutenberg editor to lesson post type
272 *
273 * @since 2.1.6
274 */
275 $enable_gutenberg = (bool) tutor_utils()->get_option( 'enable_gutenberg_course_edit' );
276 if ( $enable_gutenberg ) {
277 $args['show_in_rest'] = true;
278 }
279
280 register_post_type( $lesson_post_type, $args );
281 }
282
283 /**
284 * Register quiz post type
285 *
286 * @since 1.0.0
287 *
288 * @return void
289 */
290 public function register_quiz_post_types() {
291 $labels = array(
292 'name' => _x( 'Quizzes', 'post type general name', 'tutor' ),
293 'singular_name' => _x( 'Quiz', 'post type singular name', 'tutor' ),
294 'menu_name' => _x( 'Quizzes', 'admin menu', 'tutor' ),
295 'name_admin_bar' => _x( 'Quiz', 'add new on admin bar', 'tutor' ),
296 'add_new' => _x( 'Add New', 'tutor quiz add', 'tutor' ),
297 'add_new_item' => __( 'Add New Quiz', 'tutor' ),
298 'new_item' => __( 'New Quiz', 'tutor' ),
299 'edit_item' => __( 'Edit Quiz', 'tutor' ),
300 'view_item' => __( 'View Quiz', 'tutor' ),
301 'all_items' => __( 'Quizzes', 'tutor' ),
302 'search_items' => __( 'Search Quizzes', 'tutor' ),
303 'parent_item_colon' => __( 'Parent Quizzes:', 'tutor' ),
304 'not_found' => __( 'No quizzes found.', 'tutor' ),
305 'not_found_in_trash' => __( 'No quizzes found in Trash.', 'tutor' ),
306 );
307
308 $args = array(
309 'labels' => $labels,
310 'description' => __( 'Description.', 'tutor' ),
311 'public' => true,
312 'publicly_queryable' => true,
313 'show_ui' => false,
314 'show_in_menu' => 'tutor',
315 'query_var' => true,
316 'rewrite' => array( 'slug' => $this->lesson_post_type ),
317 'menu_icon' => 'dashicons-editor-help',
318 'capability_type' => 'post',
319 'has_archive' => true,
320 'hierarchical' => false,
321 'menu_position' => null,
322 'supports' => array( 'title', 'editor' ),
323 'exclude_from_search' => apply_filters( 'tutor_quiz_exclude_from_search', true ),
324 'capabilities' => array(
325 'edit_post' => 'edit_tutor_quiz',
326 'read_post' => 'read_tutor_quiz',
327 'delete_post' => 'delete_tutor_quiz',
328 'delete_posts' => 'delete_tutor_quizzes',
329 'edit_posts' => 'edit_tutor_quizzes',
330 'edit_others_posts' => 'edit_others_tutor_quizzes',
331 'publish_posts' => 'publish_tutor_quizzes',
332 'read_private_posts' => 'read_private_tutor_quizzes',
333 'create_posts' => 'edit_tutor_quizzes',
334 ),
335 );
336
337 register_post_type( 'tutor_quiz', $args );
338 }
339
340 /**
341 * Register topic post type
342 *
343 * @since 1.0.0
344 *
345 * @return void
346 */
347 public function register_topic_post_types() {
348 $args = array(
349 'label' => 'Topics',
350 'description' => __( 'Description.', 'tutor' ),
351 'public' => false,
352 'publicly_queryable' => false,
353 'show_ui' => false,
354 'query_var' => false,
355 'has_archive' => false,
356 'hierarchical' => false,
357 'menu_position' => null,
358 );
359 register_post_type( 'topics', $args );
360 }
361
362 /**
363 * Register assignment post type
364 *
365 * @since 1.0.0
366 *
367 * @return void
368 */
369 public function register_assignments_post_types() {
370 $labels = array(
371 'name' => _x( 'Assignments', 'post type general name', 'tutor' ),
372 'singular_name' => _x( 'Assignment', 'post type singular name', 'tutor' ),
373 'menu_name' => _x( 'Assignments', 'admin menu', 'tutor' ),
374 'name_admin_bar' => _x( 'Assignment', 'add new on admin bar', 'tutor' ),
375 'add_new' => _x( 'Add New', 'tutor assignment add', 'tutor' ),
376 'add_new_item' => __( 'Add New Assignment', 'tutor' ),
377 'new_item' => __( 'New Assignment', 'tutor' ),
378 'edit_item' => __( 'Edit Assignment', 'tutor' ),
379 'view_item' => __( 'View Assignment', 'tutor' ),
380 'all_items' => __( 'Assignments', 'tutor' ),
381 'search_items' => __( 'Search Assignments', 'tutor' ),
382 'parent_item_colon' => __( 'Parent Assignments:', 'tutor' ),
383 'not_found' => __( 'No Assignments found.', 'tutor' ),
384 'not_found_in_trash' => __( 'No Assignments found in Trash.', 'tutor' ),
385 );
386
387 $args = array(
388 'labels' => $labels,
389 'description' => __( 'Description.', 'tutor' ),
390 'public' => true,
391 'publicly_queryable' => true,
392 'show_ui' => false,
393 'show_in_menu' => 'tutor',
394 'query_var' => true,
395 'rewrite' => array( 'slug' => $this->lesson_post_type ),
396 'menu_icon' => 'dashicons-editor-help',
397 'capability_type' => 'post',
398 'has_archive' => true,
399 'hierarchical' => false,
400 'menu_position' => null,
401 'supports' => array( 'title', 'editor' ),
402 'exclude_from_search' => apply_filters( 'tutor_assignment_exclude_from_search', true ),
403 'capabilities' => array(
404 'edit_post' => 'edit_tutor_assignment',
405 'read_post' => 'read_tutor_assignment',
406 'delete_post' => 'delete_tutor_assignment',
407 'delete_posts' => 'delete_tutor_assignments',
408 'edit_posts' => 'edit_tutor_assignments',
409 'edit_others_posts' => 'edit_others_tutor_assignments',
410 'publish_posts' => 'publish_tutor_assignments',
411 'read_private_posts' => 'read_private_tutor_assignments',
412 'create_posts' => 'edit_tutor_assignments',
413 ),
414 );
415
416 register_post_type( 'tutor_assignments', $args );
417 }
418
419 /**
420 * Course update messages
421 *
422 * @since 1.0.0
423 *
424 * @param array $messages messages.
425 *
426 * @return mixed
427 */
428 public function course_updated_messages( $messages ) {
429 $post = get_post();
430 $post_type = get_post_type( $post );
431 $post_type_object = get_post_type_object( $post_type );
432
433 $course_post_type = tutor()->course_post_type;
434
435 $revision = Input::get( 'revision' );
436 $revision_msg = __( 'Course restored to revision from ', 'tutor' );
437 if ( ! is_null( $revision ) ) {
438 $revision_msg .= wp_post_revision_title( $revision );
439 } else {
440 $revision_msg = false;
441 }
442
443 $schedule_date = date_i18n( __( 'M j, Y @ G:i', 'tutor' ), strtotime( $post->post_date ) );
444 $schedule_msg = __( 'Course scheduled for:', 'tutor' );
445 $schedule_msg .= ' <strong> ' . $schedule_date . ' </strong>';
446
447 $messages[ $course_post_type ] = array(
448 0 => '', // Unused. Messages start at index 1.
449 1 => __( 'Course updated.', 'tutor' ),
450 2 => __( 'Custom field updated.', 'tutor' ),
451 3 => __( 'Custom field deleted.', 'tutor' ),
452 4 => __( 'Course updated.', 'tutor' ),
453 5 => $revision_msg,
454 6 => __( 'Course published.', 'tutor' ),
455 7 => __( 'Course saved.', 'tutor' ),
456 8 => __( 'Course submitted.', 'tutor' ),
457 9 => $schedule_msg,
458 10 => __( 'Course draft updated.', 'tutor' ),
459 );
460
461 if ( $post_type_object->publicly_queryable && $course_post_type === $post_type ) {
462 $permalink = get_permalink( $post->ID );
463
464 $view_link = sprintf( ' <a href="%s">%s</a>', esc_url( $permalink ), __( 'View course', 'tutor' ) );
465 $messages[ $post_type ][1] .= $view_link;
466 $messages[ $post_type ][6] .= $view_link;
467 $messages[ $post_type ][9] .= $view_link;
468
469 $preview_permalink = add_query_arg( 'preview', 'true', $permalink );
470 $preview_link = sprintf( ' <a target="_blank" href="%s">%s</a>', esc_url( $preview_permalink ), __( 'Preview course', 'tutor' ) );
471 $messages[ $post_type ][8] .= $preview_link;
472 $messages[ $post_type ][10] .= $preview_link;
473 }
474
475 return $messages;
476 }
477
478 /**
479 * Gutenberg can edit post filter handler
480 *
481 * @since 1.0.0
482 *
483 * @param bool $can_edit use block editor.
484 * @param string $post_type post type.
485 *
486 * @return bool
487 *
488 * Enable / Disable Gutenberg Editor
489 * @since v.1.3.4
490 */
491 public function gutenberg_can_edit_post_type( $can_edit, $post_type ) {
492 $enable_gutenberg = (bool) tutor_utils()->get_option( 'enable_gutenberg_course_edit' );
493 return $this->course_post_type === $post_type ? $enable_gutenberg : $can_edit;
494 }
495
496 /**
497 * Register tutor_enrolled post type
498 *
499 * @since v.1.4.0
500 */
501 public function register_tutor_enrolled_post_types() {
502 $args = array(
503 'label' => 'Tutor Enrolled',
504 'description' => __( 'Description.', 'tutor' ),
505 'public' => false,
506 'publicly_queryable' => false,
507 'show_ui' => false,
508 'query_var' => false,
509 'has_archive' => false,
510 'hierarchical' => false,
511 'menu_position' => null,
512 );
513 register_post_type( 'tutor_enrolled', $args );
514 }
515
516 /**
517 * Remove course post menu
518 *
519 * @return void
520 * @since v2.0.0
521 */
522 public function remove_course_post_menu() {
523 remove_menu_page( 'edit.php?post_type=' . tutor()->course_post_type );
524 }
525 }
526