• Resolved thisismee

    (@thisismee)


    I write my mobile menu, independent of the WordPress menu. How can I restrict the display of links in the menu to users based on the user’s role?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @thisismee

    Here’s an example code to add it to your conditional menu:

    
    $user_id = get_current_user_id();
    um_fetch_user( $user_id ); 
    $user_role = um_user('role');
    
    switch( $user_role ){
      case 'subscriber':
          // do something
      break;
      case 'author':
          // do something
      break;
    } 
    

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @thisismee
    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.