mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
16 lines
580 B
Text
16 lines
580 B
Text
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);
|
|
}
|
|
}
|