Hello,
I want to hide the My Courses, Results and Stats tabs and only leave the Instructing Courses tabs for Instructors (Only for instructor as Students need these). Instructors don't need them and I want them to hide. Is there a codes that do this tasks?
Thanks in advance.
@jqschied,
Please paste this code in wp-admin > Plugins > Editor > Select WPLMS Customizer Plugin > wplms-customizer.php
This will remove the tabs for instructors only. But it will not remove my-courses tab because the function I ma using here need the slug of the tab which you want to remove. The slug of courses and my courses tabs are same. So I can hide my courses tab instead of removing the tab.
//Remove results,stats,my courses tab for instructors only
add_action('bp_setup_nav','bp_remove_menu_tabs_from_user_profile',999);
function bp_remove_menu_tabs_from_user_profile() {
if(current_user_can('instructor')){
bp_core_remove_subnav_item('course','course-stats');
bp_core_remove_subnav_item('course','course-results');
?>
<style>
.bp-user #buddypress .item-list-tabs#subnav ul li #course{display:none;}
</style>
<?php
}
}
Thanks!
It worked. But can the tab "Course" default to "Instructing Courses" instead of the hidden "My Courses"? Currently, it says "No Courses found". Instructor needs to click on "Instructing Courses" before they see the content. Is there a code to adjust to make the default be "Instructing Courses", so no more extra click?
@jqschied
Yes, this is possible using javascript code. Please wait for my next reply.
Hi @Diana,
Any update on this? Thanks
@jqschied,
Forgot to check this. Thanks for reminding me.
Let me check
@diana,
K, just let me know when the code is ready and I'll try it out. Thanks!
@diana,
how's this request? updates?
@jqschied,
I think this will do the trick. Please paste the code with script tag in wp-admin > WPLMS > Footer
$(document).ready(function() {
$('#course-personal-li').removeClass('current');
$('#instructor-courses-personal-li').addClass('current');
});