Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Created March 14, 2022 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalchild/7a6cd60f85a5d0e2d6b530768c531231 to your computer and use it in GitHub Desktop.
Save digitalchild/7a6cd60f85a5d0e2d6b530768c531231 to your computer and use it in GitHub Desktop.
Add the vendor role to an instructor when they are approved.
<?php
/**
* Required Tutor LMS v.1.6.0
*/
add_action('tutor_new_instructor_after', 'wcv_add_vendor_role');
/**
* @param $instructor_id
*
* Add thhe vendor role to the user when they are approved to be an instructor.
*/
if ( ! function_exists('wcv_add_vendor_role')){
function wcv_add_vendor_role($instructor_id){
$instructor = new \WP_User($instructor_id);
$instructor->add_role('vendor');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment