Laura Venturini

Forum Replies Created

Viewing 2 posts - 16 through 17 (of 17 total)
  • Author
    Posts
  • in reply to: Hide profile tabs to users by role #397616

    Laura Venturini
    Expired Member
    Post count: 36

    I solved the first part with this code in bp-custom.php:

    
    
    function bpfr_remove_nav_tabs() {
    
      $user = wp_get_current_user();
      $allowed_roles = array('subscriber');
      if( array_intersect($allowed_roles, $user->roles ) ) {
        bp_core_remove_nav_item( 'listings' );
        bp_core_remove_nav_item( 'invoices' );
      }
    }
    add_action( 'bp_setup_nav', 'bpfr_remove_nav_tabs', 15 );

    Thanks a lot, hope you can help me with my second issue.

    in reply to: Hide profile tabs to users by role #397610

    Laura Venturini
    Expired Member
    Post count: 36

    Thanks Paolo!

    I have another related question: how can I hide “Add listing” menu item if the user is a subscriber.

    I know I can do all this stuff via css, but I prefer a php method if it exists. 🙂

    Thanks!

Viewing 2 posts - 16 through 17 (of 17 total)