Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customize Group Admin subnavigation

  • @dcavins

    Keymaster

    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)
  • @dcavins

    Keymaster

    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)
  • The topic ‘Customize Group Admin subnavigation’ is closed to new replies.
Skip to toolbar