Show Admin Tab For Another User Role

This code is used to show admin tab on single course page for shop manager users. You can change the user role in the below code to show it for another user role.

Paste this code in wp-admin > Plugins > Editor > Select WPLMS Customizer Plugin > wplms-customizer.php

add_filter('wplms_course_instructors',function($authors){

if(!is_user_logged_in())

return false;

$user = wp_get_current_user();

if(!empty($user) && !empty($user->roles) && in_array('shop_manager', $user->roles)){

if(empty($authors)){

$authors = array($user->ID);

}else{

$authors[] = $user->ID;

}

}

return $authors;

});

Leave a Reply

Your email address will not be published. Required fields are marked *