Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nayeemch/1615165c5476699e993c9ec742d71c32 to your computer and use it in GitHub Desktop.
Save nayeemch/1615165c5476699e993c9ec742d71c32 to your computer and use it in GitHub Desktop.
Automatically approve Tutor LMS instructor right after register. No manual approval required.
/**
* 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