Skip to content

Commit 77fc2c4

Browse files
authored
Create lifterlms-courses-shortcode-include-instructor-courses.php
1 parent 8b02a2e commit 77fc2c4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php // <- do not copy this line.
2+
/**
3+
* Display only enrolled courses in dashboard's My Courses.
4+
*
5+
* https://lifterlms.com/docs/how-do-i-add-custom-code-to-lifterlms/
6+
*/
7+
add_filter( 'llms_courses_shortcode_get_post__in', function( $ids ) {
8+
if ( ! is_user_logged_in() ) {
9+
return $ids;
10+
}
11+
12+
$instructor = llms_get_instructor();
13+
14+
if ( ! $instructor ) {
15+
return $ids;
16+
}
17+
18+
return array_merge( $ids, $instructor->get_courses( array(), 'ids' ) );
19+
} );

0 commit comments

Comments
 (0)