Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customize Group Admin subnavigation

  • Avatar of dcavins
    dcavins
    Participant

    @dcavins

    I’d like to leave some of the group administration duties up to site admins instead of group admins. My first thought was to only show the subnav tabs to site admins using this approach:

    if ( !( current_user_can('update_plugins') ) ) {
        bp_core_remove_subnav_item( bp_get_current_group_slug(),'send-invites');
      }

    However, the group admin menu seems to be created differently than other navigation pieces (some of the items are hardcoded, others have to be created by plugins). Does anyone know of a way to conditionally modify the group admin menu?

    Thanks for your help,

    -David

Viewing 1 replies (of 1 total)
  • Avatar of dcavins
    dcavins
    Participant

    @dcavins

    As a hack I can hide them using css by adding this to my functions.php file:

    function hide_group_admin_tabs($classes) {
      $user_id =  bp_loggedin_user_id();
      $group_id =  bp_get_current_group_id();
      if ( bp_is_groups_component() ) {
        if ( groups_is_user_admin($user_id, $group_id) ) {
          $classes[] = 'group-member-admin-cap';
        } else if ( groups_is_user_mod($user_id, $group_id) ) {
          $classes[] = 'group-member-mod-cap';
        }
      }
      return $classes;
    }
    add_filter( 'body_class', 'hide_group_admin_tabs', 98 );

    And then adding display:none; rules to the tabs. But I would like to handle the navigation the right way (and not with a css hack). Any ideas?

    Thanks for your help,

    -David

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.