Last active
March 9, 2021 08:17
-
-
Save shohel/716daff96d9367ab9e928066d430dd1e to your computer and use it in GitHub Desktop.
This will help you to update / add/ remove the course access method for Dozent LMS, FYI: Dozent LMS is a Modern, Scalable Learning Management System Plugin For WordPress
This file contains hidden or 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
//Add this code to your course themes/activated-theme/functions.php | |
// Remove access methods | |
add_filter( 'dozent_course_access_methods', 'remove_dozent_course_access_methods' ); | |
if ( ! function_exists( 'remove_dozent_course_access_methods' ) ) { | |
function remove_dozent_course_access_methods( $methods ){ | |
if ( isset( $methods[ 'public' ] ) ) { | |
unset( $methods[ 'public' ] ); | |
} | |
if ( isset( $methods[ 'protected' ] ) ) { | |
unset( $methods[ 'protected' ] ); | |
} | |
return $methods; | |
} | |
} | |
// Add course methods | |
add_filter( 'dozent_course_access_methods', 'add_dozent_course_access_methods' ); | |
if ( ! function_exists( 'add_dozent_course_access_methods' ) ) { | |
function add_dozent_course_access_methods( $methods ){ | |
$methods['extra_method'] = [ | |
'label' => __( 'Extra Method', 'textdomain' ), | |
'description' => __( 'Extra access method for this course', 'textdomain' ), | |
'inner_callback' => 'extra_method_callback_function', | |
//add function and write some html to show when user will select this method | |
]; | |
return $methods; | |
} | |
} | |
// Edit Course methods lebel or description | |
add_filter( 'dozent_course_access_methods', 'add_dozent_course_access_methods' ); | |
if ( ! function_exists( 'add_dozent_course_access_methods' ) ) { | |
function add_dozent_course_access_methods( $methods ){ | |
$methods['protected'][ 'label' ] = __( 'Updated Protected', 'textdomain' ); | |
$methods['protected'][ 'description' ] = __( 'Updated description', 'textdomain' ); | |
return $methods; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment