Home › Forums › Legacy Support › Support queries › How-to & Troubleshooting › How to show course "admin" tab for other user roles than administrator
- This topic has 13 replies, 2 voices, and was last updated 5 years, 4 months ago by
Diana.
Viewing 14 posts - 1 through 14 (of 14 total)
-
AuthorPosts
-
July 2, 2018 at 11:23 am #167886
waytogo
SpectatorIs 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?July 3, 2018 at 7:12 am #167993Diana
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/July 3, 2018 at 8:05 am #167999waytogo
SpectatorThank 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?July 3, 2018 at 1:22 pm #168047Diana
Participant@waytogo Is there any specific user role for which you want to show admin tab for single coursesJuly 3, 2018 at 1:23 pm #168049waytogo
SpectatorI 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.July 4, 2018 at 6:18 am #168118Diana
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; });July 4, 2018 at 9:06 am #168134waytogo
SpectatorSo 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?July 5, 2018 at 1:02 pm #168322Diana
Participant@waytogo, let me check againJuly 9, 2018 at 10:16 am #168578waytogo
Spectatorany progress?July 10, 2018 at 8:00 am #168696Diana
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; });July 21, 2018 at 5:51 pm #170071waytogo
Spectatorsorry, 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).July 23, 2018 at 6:02 am #170113Diana
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.July 23, 2018 at 4:56 pm #170210waytogo
SpectatorI 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.July 24, 2018 at 4:28 am #170227Diana
Participant@waytogo, That's Great..!! Closing this topic then -
AuthorPosts
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.