Created
May 8, 2020 19:14
-
-
Save nayeemch/1615165c5476699e993c9ec742d71c32 to your computer and use it in GitHub Desktop.
Automatically approve Tutor LMS instructor right after register. No manual approval required.
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
/** | |
* Required Tutor LMS v.1.6.0 | |
*/ | |
add_action('tutor_new_instructor_after', 'approve_new_instructor_immediately'); | |
/** | |
* @param $instructor_id | |
* | |
* Immediately approve instructor after register | |
*/ | |
if ( ! function_exists('approve_new_instructor_immediately')){ | |
function approve_new_instructor_immediately($instructor_id){ | |
update_user_meta($instructor_id, '_tutor_instructor_status', 'approved'); | |
update_user_meta($instructor_id, '_tutor_instructor_approved', tutor_time()); | |
$instructor = new \WP_User($instructor_id); | |
$instructor->add_role(tutor()->instructor_role); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment