Last active
December 5, 2016 19:54
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't copy this line to your functions.php file | |
/** | |
* Ahh a post type to the list of post types LifterLMS will NOT check for membership restrictions | |
* @param array $post_types array of post type names | |
* @return array | |
*/ | |
function my_allow_lessons_restrictions( $post_types ) { | |
array_push( $post_types, 'my_custom_post_type' ); | |
return $post_types; | |
} | |
add_filter( 'llms_is_post_restricted_by_membership_skip_post_types', 'my_allow_lessons_restrictions' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // don't copy this line to your functions.php file | |
/** | |
* Remove a post type from the list of post types LifterLMS will NOT check for membership restrictions | |
* @param array $post_types array of post type names | |
* @return array | |
*/ | |
function my_allow_lessons_restrictions( $post_types ) { | |
// the following post types are automatically bypassed | |
// during membership restriction checks | |
// course | |
// lesson | |
// llms_quiz | |
// llms_membership | |
// llms_question | |
// llms_certificate | |
// llms_my_certificate | |
// this will remove lessons from the list so that lessons can be restricted | |
$i = array_search( 'lesson', $post_types ); | |
if ( false !== $i ) { | |
unset( $post_types[ $i ] ); | |
} | |
return $post_types; | |
} | |
add_filter( 'llms_is_post_restricted_by_membership_skip_post_types', 'my_allow_lessons_restrictions' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment