How to show the custom menu page where user is allowed to show only profile page?

46 views Asked by At

I want to register custom menu page where user membership role is "I Want A Personal Trainer". But the plugin already used in this site is show only profile page on dashboard for the specific user. Now i want to force it to show for user whose membership role is "I Want A Personal Trainer" Here is my code

    $user_role = wp_get_current_user();
     $personal_trainer = $user_role->membership_level->name;                
  if($personal_trainer == "I Want A Personal Trainer"){  
function register_custom_menu_page() {
    add_menu_page('Your Lead Profile', 'custom menu', 'manage_options', 'custompage', '_custom_menu_page', null, 1); 
}
add_action('admin_menu', 'register_custom_menu_page');
function _custom_menu_page(){
   echo "Admin Page Test";  
}
  }
0

There are 0 answers