Changeset 9131
- Timestamp:
- 11/10/2014 07:13:04 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-buddybar.php
r8568 r9131 254 254 * @type string $link Optional. The URL that the subnav item should point 255 255 * to. Defaults to a value generated from the $parent_url + $slug. 256 * @type bool $show_in_admin_bar Optional. Whether the nav item should be 257 * added into the group's "Edit" Admin Bar menu for group admins. 258 * Default: false. 256 259 * } 257 260 * @return bool|null Returns false on failure. … … 261 264 262 265 $r = wp_parse_args( $args, array( 263 'name' => false, // Display name for the nav item 264 'slug' => false, // URL slug for the nav item 265 'parent_slug' => false, // URL slug of the parent nav item 266 'parent_url' => false, // URL of the parent item 267 'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item 268 'user_has_access' => true, // Can the logged in user see this nav item? 269 'no_access_url' => '', 270 'site_admin_only' => false, // Can only site admins see this nav item? 271 'position' => 90, // Index of where this nav item should be positioned 272 'screen_function' => false, // The name of the function to run when clicked 273 'link' => '' // The link for the subnav item; optional, not usually required. 266 'name' => false, // Display name for the nav item 267 'slug' => false, // URL slug for the nav item 268 'parent_slug' => false, // URL slug of the parent nav item 269 'parent_url' => false, // URL of the parent item 270 'item_css_id' => false, // The CSS ID to apply to the HTML of the nav item 271 'user_has_access' => true, // Can the logged in user see this nav item? 272 'no_access_url' => '', 273 'site_admin_only' => false, // Can only site admins see this nav item? 274 'position' => 90, // Index of where this nav item should be positioned 275 'screen_function' => false, // The name of the function to run when clicked 276 'link' => '', // The link for the subnav item; optional, not usually required. 277 'show_in_admin_bar' => false, // Show the Manage link in the current group's "Edit" Admin Bar menu 274 278 ) ); 275 279 … … 298 302 299 303 $subnav_item = array( 300 'name' => $name, 301 'link' => trailingslashit( $link ), 302 'slug' => $slug, 303 'css_id' => $item_css_id, 304 'position' => $position, 305 'user_has_access' => $user_has_access, 306 'no_access_url' => $no_access_url, 307 'screen_function' => &$screen_function 304 'name' => $name, 305 'link' => trailingslashit( $link ), 306 'slug' => $slug, 307 'css_id' => $item_css_id, 308 'position' => $position, 309 'user_has_access' => $user_has_access, 310 'no_access_url' => $no_access_url, 311 'screen_function' => &$screen_function, 312 'show_in_admin_bar' => (bool) $r['show_in_admin_bar'], 308 313 ); 314 309 315 $bp->bp_options_nav[$parent_slug][$slug] = $subnav_item; 310 316 -
trunk/src/bp-groups/bp-groups-adminbar.php
r9026 r9131 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 … … 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 ) ); 49 // Index of the Manage tabs parent slug 50 $nav_index = $bp->groups->current_group->slug . '_manage'; 53 51 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 ) ); 61 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 ) ); 57 // Build the Group Admin menus 58 foreach ( $bp->bp_options_nav[ $nav_index ] as $menu ) { 59 /** 60 * Should we add the current manage link in the Group's "Edit" Admin Bar menu ? 61 * 62 * All core items will be added, plugins can use a new parameter in the BP Group Extension API 63 * to also add the link to the "edit screen" of their group component. To do so, set the 64 * the 'show_in_admin_bar' argument of your edit screen to true 65 */ 66 if ( $menu['show_in_admin_bar'] ) { 67 $title = sprintf( _x( 'Edit Group %s', 'Group WP Admin Bar manage links', 'buddypress' ), $menu['name'] ); 68 69 // Title is specific for delete 70 if ( 'delete-group' == $menu['slug'] ) { 71 $title = sprintf( _x( '%s Group', 'Group WP Admin Bar delete link', 'buddypress' ), $menu['name'] ); 72 } 73 74 $wp_admin_bar->add_menu( array( 75 'parent' => $bp->group_admin_menu_id, 76 'id' => $menu['slug'], 77 'title' => $title, 78 'href' => bp_get_groups_action_link( 'admin/' . $menu['slug'] ) 79 ) ); 80 } 80 81 } 81 82 // Group Admin > Manage members83 $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 ) );89 90 // Group Admin > Membership Requests91 if ( bp_get_group_status( $bp->groups->current_group ) == 'private' ) {92 $wp_admin_bar->add_menu( array(93 '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' )97 ) );98 }99 100 // Delete Group101 $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 82 } 108 83 add_action( 'admin_bar_menu', 'bp_groups_group_admin_menu', 99 ); -
trunk/src/bp-groups/bp-groups-classes.php
r9130 r9131 3668 3668 $admin_link = trailingslashit( bp_get_group_permalink( $current_group ) . 'admin' ); 3669 3669 3670 // Add the tab to the manage navigation 3671 bp_core_new_subnav_item( array( 3670 $subnav_args = array( 3672 3671 'name' => $screen['name'], 3673 3672 'slug' => $screen['slug'], … … 3677 3676 'position' => $position, 3678 3677 'screen_function' => 'groups_screen_group_admin', 3679 ) ); 3678 ); 3679 3680 // Should we add a menu to the Group's WP Admin Bar 3681 if ( ! empty( $screen['show_in_admin_bar'] ) ) { 3682 $subnav_args['show_in_admin_bar'] = true; 3683 } 3684 3685 // Add the tab to the manage navigation 3686 bp_core_new_subnav_item( $subnav_args ); 3680 3687 3681 3688 // Catch the edit screen and forward it to the plugin template -
trunk/src/bp-groups/bp-groups-loader.php
r9127 r9131 508 508 'no_access_url' => $group_link, 509 509 ); 510 } 511 512 // If viewing an admin page, create the group admin subnav items 513 if ( bp_is_group_admin_page() ) { 510 514 511 $admin_link = trailingslashit( $group_link . 'admin' ); 515 512 516 513 // Common params to all nav items 517 514 $default_params = array( 518 'parent_url' => $admin_link, 519 'parent_slug' => $this->current_group->slug . '_manage', 520 'screen_function' => 'groups_screen_group_admin', 521 'user_has_access' => bp_is_item_admin(), 515 'parent_url' => $admin_link, 516 'parent_slug' => $this->current_group->slug . '_manage', 517 'screen_function' => 'groups_screen_group_admin', 518 'user_has_access' => bp_is_item_admin(), 519 'show_in_admin_bar' => true, 522 520 ); 523 521
Note: See TracChangeset
for help on using the changeset viewer.