diff --git src/bp-core/bp-core-buddybar.php src/bp-core/bp-core-buddybar.php
index 8a67505..9edb8e7 100644
|
|
function bp_core_new_subnav_item( $args = '' ) { |
306 | 306 | 'no_access_url' => $no_access_url, |
307 | 307 | 'screen_function' => &$screen_function |
308 | 308 | ); |
| 309 | |
| 310 | if ( ! empty( $r['in_admin_bar'] ) ) { |
| 311 | $subnav_item['in_admin_bar'] = (bool) $r['in_admin_bar']; |
| 312 | } |
| 313 | |
309 | 314 | $bp->bp_options_nav[$parent_slug][$slug] = $subnav_item; |
310 | 315 | |
311 | 316 | /** |
diff --git src/bp-groups/bp-groups-adminbar.php src/bp-groups/bp-groups-adminbar.php
index 33e7679..7b5c874 100644
|
|
if ( !defined( 'ABSPATH' ) ) exit; |
23 | 23 | * access to group admin options. |
24 | 24 | */ |
25 | 25 | function bp_groups_group_admin_menu() { |
26 | | global $wp_admin_bar, $bp; |
| 26 | global $wp_admin_bar; |
| 27 | $bp = buddypress(); |
27 | 28 | |
28 | 29 | // Only show if viewing a group |
29 | | if ( !bp_is_group() ) |
| 30 | if ( ! bp_is_group() || bp_is_group_create() ) { |
30 | 31 | return false; |
| 32 | } |
31 | 33 | |
32 | 34 | // Only show this menu to group admins and super admins |
33 | | if ( !bp_current_user_can( 'bp_moderate' ) && !bp_group_is_admin() ) |
| 35 | if ( ! bp_current_user_can( 'bp_moderate' ) && ! bp_group_is_admin() ) { |
34 | 36 | return false; |
| 37 | } |
35 | 38 | |
36 | 39 | // Unique ID for the 'Edit Group' menu |
37 | 40 | $bp->group_admin_menu_id = 'group-admin'; |
… |
… |
function bp_groups_group_admin_menu() { |
43 | 46 | 'href' => bp_get_group_permalink( $bp->groups->current_group ) |
44 | 47 | ) ); |
45 | 48 | |
46 | | // Group Admin > Edit details |
47 | | $wp_admin_bar->add_menu( array( |
48 | | 'parent' => $bp->group_admin_menu_id, |
49 | | 'id' => 'edit-details', |
50 | | 'title' => __( 'Edit Details', 'buddypress' ), |
51 | | 'href' => bp_get_groups_action_link( 'admin/edit-details' ) |
52 | | ) ); |
53 | | |
54 | | // Group Admin > Group settings |
55 | | $wp_admin_bar->add_menu( array( |
56 | | 'parent' => $bp->group_admin_menu_id, |
57 | | 'id' => 'group-settings', |
58 | | 'title' => __( 'Edit Settings', 'buddypress' ), |
59 | | 'href' => bp_get_groups_action_link( 'admin/group-settings' ) |
60 | | ) ); |
| 49 | // Index of the Manage tabs parent slug |
| 50 | $nav_index = $bp->groups->current_group->slug . '_manage'; |
61 | 51 | |
62 | | // Group Admin > Group avatar |
63 | | if ( !(int)bp_get_option( 'bp-disable-avatar-uploads' ) && $bp->avatar->show_avatars ) { |
64 | | $wp_admin_bar->add_menu( array( |
65 | | 'parent' => $bp->group_admin_menu_id, |
66 | | 'id' => 'group-avatar', |
67 | | 'title' => __( 'Edit Profile Photo', 'buddypress' ), |
68 | | 'href' => bp_get_groups_action_link( 'admin/group-avatar' ) |
69 | | ) ); |
| 52 | // Check if current group has Manage tabs |
| 53 | if ( empty( $bp->bp_options_nav[ $nav_index ] ) ) { |
| 54 | return; |
70 | 55 | } |
71 | 56 | |
72 | | // Group Admin > Manage invitations |
73 | | if ( bp_is_active( 'friends' ) ) { |
74 | | $wp_admin_bar->add_menu( array( |
75 | | 'parent' => $bp->group_admin_menu_id, |
76 | | 'id' => 'manage-invitations', |
77 | | 'title' => __( 'Manage Invitations', 'buddypress' ), |
78 | | 'href' => bp_get_groups_action_link( 'send-invites' ) |
79 | | ) ); |
80 | | } |
| 57 | // Build the Group Admin menus |
| 58 | foreach ( $bp->bp_options_nav[ $nav_index ] as $menu ) { |
| 59 | // Only display the core tabs (could be an option in Group Extension API) |
| 60 | if ( empty( $menu['in_admin_bar'] ) ) { |
| 61 | continue; |
| 62 | } |
81 | 63 | |
82 | | // Group Admin > Manage members |
83 | | $wp_admin_bar->add_menu( array( |
84 | | 'parent' => $bp->group_admin_menu_id, |
85 | | 'id' => 'manage-members', |
86 | | 'title' => __( 'Manage Members', 'buddypress' ), |
87 | | 'href' => bp_get_groups_action_link( 'admin/manage-members' ) |
88 | | ) ); |
| 64 | $title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu['name'] ); |
| 65 | |
| 66 | // Title is specific for delete |
| 67 | if ( 'delete-group' == $menu['slug'] ) { |
| 68 | $title = sprintf( _x( '%s Group', 'Group WP Admin Bar delete link', 'buddypress' ), $menu['name'] ); |
| 69 | } |
89 | 70 | |
90 | | // Group Admin > Membership Requests |
91 | | if ( bp_get_group_status( $bp->groups->current_group ) == 'private' ) { |
92 | 71 | $wp_admin_bar->add_menu( array( |
93 | 72 | 'parent' => $bp->group_admin_menu_id, |
94 | | 'id' => 'membership-requests', |
95 | | 'title' => __( 'Membership Requests', 'buddypress' ), |
96 | | 'href' => bp_get_groups_action_link( 'admin/membership-requests' ) |
| 73 | 'id' => $menu['slug'] . '-group-manage-links', |
| 74 | 'title' => $title, |
| 75 | 'href' => bp_get_groups_action_link( 'admin/' . $menu['slug'] ) |
97 | 76 | ) ); |
98 | 77 | } |
99 | | |
100 | | // Delete Group |
101 | | $wp_admin_bar->add_menu( array( |
102 | | 'parent' => $bp->group_admin_menu_id, |
103 | | 'id' => 'delete-group', |
104 | | 'title' => __( 'Delete Group', 'buddypress' ), |
105 | | 'href' => bp_get_groups_action_link( 'admin/delete-group' ) |
106 | | ) ); |
107 | 78 | } |
108 | 79 | add_action( 'admin_bar_menu', 'bp_groups_group_admin_menu', 99 ); |
109 | 80 | |
diff --git src/bp-groups/bp-groups-classes.php src/bp-groups/bp-groups-classes.php
index f84e2f7..5a65456 100644
|
|
class BP_Group_Extension { |
3655 | 3655 | $current_group = groups_get_current_group(); |
3656 | 3656 | $admin_link = trailingslashit( bp_get_group_permalink( $current_group ) . 'admin' ); |
3657 | 3657 | |
3658 | | // Add the tab to the manage navigation |
3659 | | bp_core_new_subnav_item( array( |
| 3658 | $subnav_args = array( |
3660 | 3659 | 'name' => $screen['name'], |
3661 | 3660 | 'slug' => $screen['slug'], |
3662 | 3661 | 'parent_slug' => $current_group->slug . '_manage', |
… |
… |
class BP_Group_Extension { |
3664 | 3663 | 'user_has_access' => bp_is_item_admin(), |
3665 | 3664 | 'position' => $position, |
3666 | 3665 | 'screen_function' => 'groups_screen_group_admin', |
3667 | | ) ); |
| 3666 | ); |
| 3667 | |
| 3668 | // Should we add a menu to the Group's WP Admin Bar |
| 3669 | if ( ! empty( $screen['in_admin_bar'] ) ) { |
| 3670 | $subnav_args['in_admin_bar'] = true; |
| 3671 | } |
| 3672 | |
| 3673 | // Add the tab to the manage navigation |
| 3674 | bp_core_new_subnav_item( $subnav_args ); |
3668 | 3675 | |
3669 | 3676 | // Catch the edit screen and forward it to the plugin template |
3670 | 3677 | if ( bp_is_groups_component() && bp_is_current_action( 'admin' ) && bp_is_action_variable( $screen['slug'], 0 ) ) { |
diff --git src/bp-groups/bp-groups-loader.php src/bp-groups/bp-groups-loader.php
index d3ccbcf..2a30d71 100644
|
|
class BP_Groups_Component extends BP_Component { |
507 | 507 | 'item_css_id' => 'admin', |
508 | 508 | 'no_access_url' => $group_link, |
509 | 509 | ); |
510 | | } |
511 | 510 | |
512 | | // If viewing an admin page, create the group admin subnav items |
513 | | if ( bp_is_group_admin_page() ) { |
514 | 511 | $admin_link = trailingslashit( $group_link . 'admin' ); |
515 | 512 | |
516 | 513 | // Common params to all nav items |
… |
… |
class BP_Groups_Component extends BP_Component { |
519 | 516 | 'parent_slug' => $this->current_group->slug . '_manage', |
520 | 517 | 'screen_function' => 'groups_screen_group_admin', |
521 | 518 | 'user_has_access' => bp_is_item_admin(), |
| 519 | 'in_admin_bar' => true, |
522 | 520 | ); |
523 | 521 | |
524 | 522 | $sub_nav[] = array_merge( array( |