How to show course "admin" tab for other user roles than administrator

Home Forums Legacy Support Support queries How-to & Troubleshooting How to show course "admin" tab for other user roles than administrator

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #167886
    waytogo
    Spectator
    Is it possible to show the "admin" tab of a course to an other user roles than only the admin? We have editors or test users which should have the possibility to enroll and delete themselves from a course or reset the statistics or lesson status without the help of the system administrator. Is there a hook for that?
    #167993
    Diana
    Participant
    @waytogo, We are using the logic that if the course is created by any user(He must be an administrator/ Instructor). Only then he can view the admin Tab If you are using our addon wplms coAuthors Plus. Then you can add multiple Instructors for a single Course and all these instructors can access the admin tab Refer: https://wplms.io/support/knowledge-base/wplms-coauthor-plus-integration/
    #167999
    waytogo
    Spectator
    Thank you for your tipp. I know that instructors have the possibility to access the course. The point is that I don't want any editor as an additional instructor (CoAuthor) in every course. These editors would appear in some views too as authors which would look very strange and they also would get any e-mail notifications and so on (same like instructors). I need kind of a 2nd administrator who has the ability to see the admin tab for every course. We edit our courses and lessons centralized from 1-3 editors and don't use the instructor to handle each course. So is there any hook/program code to achieve that?
    #168047
    Diana
    Participant
    @waytogo Is there any specific user role for which you want to show admin tab for single courses
    #168049
    waytogo
    Spectator
    I have defined own user roles with a user manager/permission plugin (User Manager Pro for example) but Shop Manager is one of them. Because our Shop Manager is also the editor for courses.
    #168118
    Diana
    Participant
    @waytogo, Please try this code and paste it in wp-admin > Plugins > Editor > Select WPLMS Customizer Plugin > wplms-customizer.php add_filter('wplms_course_instructors',function($authors,$course_id){ if(!is_user_logged_in()) return false; $user = wp_get_current_user(); if(!empty($user) && !empty($user->roles) && in_array('parent', $user->roles)){ if(empty($authors)){ $authors = array($user->ID);   }else{ $authors[] = $user->ID; } } return $authors; });
    #168134
    waytogo
    Spectator
    So I pasted the code in WPLMS Customizer and I also tried in the functions.php in the childtheme. As I understood your code, the role "parent" should show me the "admin" tab in the course overview? But after assigning the role to a user, nothing happened. Also the Shop Manager role doesn't work. Did I get something wrong?
    #168322
    Diana
    Participant
    @waytogo, let me check again
    #168578
    waytogo
    Spectator
    any progress?
    #168696
    Diana
    Participant
    @waytogo, paste this code in wp-admin > Plugins > Editor > Select WPLMS Customizer Plugin > wplms-customizer.php // Show Admin Tab for shop manager user Role 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; });
    #170071
    waytogo
    Spectator
    sorry, what you posted here and in your thread https://wplms.io/support/knowledge-base/show-admin-tab-for-another-user-role/ (btw. the code has copy paste errors) still doesn't work for me. I also tried it on the latest theme update on a clean installation but with a user who has shop manager role permission I don't see the tab "admin" in the front end of a course. I also tried other user roles and changed your code as explained (exchanged 'shop_manager' against a different user role).
    #170113
    Diana
    Participant
    @waytogo, I have tested the code before sending it to you. Today, again i tested the code and it is showing admin tab on single course page for shop manager user role. Please share your admin credentials with site URL here in a private reply to check this on your site.
    #170210
    waytogo
    Spectator
    I checked it again in our clean system and now it is working. Strange. I guess in my live system I have some other adaptions which influence from showing it correctly. I will deeply look into it.
    #170227
    Diana
    Participant
    @waytogo, That's Great..!! Closing this topic then
Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘How to show course "admin" tab for other user roles than administrator’ is closed to new replies.