Adding new tabs into User Profile tab
-
Hi, how do I add new tabs dependent on user role?
Here is the code that I created and tested but it does not work. Where does it wrong?
Your guide is really appreciated.
add_filter( 'learn-press/before-profile-nav', 'thim_change_tabs_course_profile_1', 10010 ); if ( !function_exists( 'thim_change_tabs_course_profile_1' ) ) { function thim_change_tabs_course_profile_1 ( $tabs ){ $settings = LP()->settings(); $profile = LP_Profile::instance(); $user = $profile->get_user(); $role = $user->get_role(); if( $role == 'user' ){ ?> <li> <a href="#"> <i class="fa-thin fa-pen-to-square"></i> Forum </a> </li> <?php } if( in_array($role, array('administrator', 'lp_teacher')) ){ ?> <li> <a href="#"> <i class="fa-thin fa-pen-to-square"></i> Edit Courses </a> </li> <li> <a href="#"> <i class="fa-thin fa-pen-to-square"></i> Forum </a> </li> <?php } return $tabs; } }
- The topic ‘Adding new tabs into User Profile tab’ is closed to new replies.