Changeset 5483 for branches/1.5/bp-groups/bp-groups-adminbar.php
- Timestamp:
- 12/10/2011 06:16:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/bp-groups/bp-groups-adminbar.php
r5052 r5483 11 11 // Exit if accessed directly 12 12 if ( !defined( 'ABSPATH' ) ) exit; 13 14 /** 15 * Adjust the admin bar menus based on which WordPress version this is 16 * 17 * @since BuddyPress (1.5.2) 18 */ 19 function bp_groups_admin_bar_version_check() { 20 if ( '3.2' == bp_get_major_wp_version() ) { 21 add_action( 'bp_setup_admin_bar', 'bp_groups_group_admin_menu', 99 ); 22 } elseif ( '3.3' == bp_get_major_wp_version() ) { 23 remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 80 ); 24 add_action( 'admin_bar_menu', 'bp_groups_group_admin_menu', 400 ); 25 } 26 } 27 add_action( 'admin_bar_menu', 'bp_groups_admin_bar_version_check', 4 ); 13 28 14 29 /** … … 31 46 return false; 32 47 33 // Group avatar 34 $avatar = bp_core_fetch_avatar( array( 35 'object' => 'group', 36 'type' => 'thumb', 37 'avatar_dir' => 'group-avatars', 38 'item_id' => $bp->groups->current_group->id, 39 'width' => 16, 40 'height' => 16 41 ) ); 48 if ( '3.2' == bp_get_major_wp_version() ) { 42 49 43 // Unique ID for the 'My Account' menu 44 $bp->group_admin_menu_id = ( ! empty( $avatar ) ) ? 'group-admin-with-avatar' : 'group-admin'; 50 // Group avatar 51 $avatar = bp_core_fetch_avatar( array( 52 'object' => 'group', 53 'type' => 'thumb', 54 'avatar_dir' => 'group-avatars', 55 'item_id' => $bp->groups->current_group->id, 56 'width' => 16, 57 'height' => 16 58 ) ); 45 59 46 // Add the top-level Group Admin button 47 $wp_admin_bar->add_menu( array( 48 'id' => $bp->group_admin_menu_id, 49 'title' => $avatar . bp_get_current_group_name(), 50 'href' => bp_get_group_permalink( $bp->groups->current_group ) 51 ) ); 60 // Unique ID for the 'My Account' menu 61 $bp->group_admin_menu_id = ( ! empty( $avatar ) ) ? 'group-admin-with-avatar' : 'group-admin'; 62 63 // Add the top-level Group Admin button 64 $wp_admin_bar->add_menu( array( 65 'id' => $bp->group_admin_menu_id, 66 'title' => $avatar . bp_get_current_group_name(), 67 'href' => bp_get_group_permalink( $bp->groups->current_group ) 68 ) ); 69 70 } elseif ( '3.3' == bp_get_major_wp_version() ) { 71 72 // Unique ID for the 'My Account' menu 73 $bp->group_admin_menu_id = 'group-admin'; 74 75 // Add the top-level Group Admin button 76 $wp_admin_bar->add_menu( array( 77 'id' => $bp->group_admin_menu_id, 78 'title' => __( 'Edit Group', 'buddypress' ), 79 'href' => bp_get_group_permalink( $bp->groups->current_group ) 80 ) ); 81 } 52 82 53 83 // Group Admin > Edit details … … 113 143 ) ); 114 144 } 115 add_action( 'bp_setup_admin_bar', 'bp_groups_group_admin_menu', 99 );116 145 117 146 ?>
Note: See TracChangeset
for help on using the changeset viewer.