Changeset 5483
- Timestamp:
- 12/10/2011 06:16:23 PM (13 years ago)
- Location:
- branches/1.5
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/bp-core/bp-core-adminbar.php
r4976 r5483 14 14 if ( !bp_use_wp_admin_bar() || defined( 'DOING_AJAX' ) ) 15 15 return; 16 17 /** 18 * Adjust the admin bar menus based on which WordPress version this is 19 * 20 * @since BuddyPress (1.5.2) 21 */ 22 function bp_core_admin_bar_version_check() { 23 if ( '3.2' == bp_get_major_wp_version() ) { 24 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_root_site', 3 ); 25 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_comments_menu', 3 ); 26 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_appearance_menu', 3 ); 27 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_updates_menu', 3 ); 28 } 29 } 30 add_action( 'admin_bar_menu', 'bp_core_admin_bar_version_check', 4 ); 16 31 17 32 /** … … 26 41 function bp_admin_bar_remove_wp_menus() { 27 42 28 remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 ); 29 remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); 30 remove_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu', 25 ); 31 32 // Don't show the 'Edit Page' menu on BP pages 33 if ( !bp_is_blog_page() ) 34 remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 ); 35 36 remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 ); 37 remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 ); 38 39 if ( !is_network_admin() && !is_user_admin() ) { 40 remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 ); 41 remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 ); 42 } 43 44 remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 ); 43 if ( '3.2' == bp_get_major_wp_version() ) { 44 remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 ); 45 remove_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 ); 46 remove_action( 'admin_bar_menu', 'wp_admin_bar_dashboard_view_site_menu', 25 ); 47 48 // Don't show the 'Edit Page' menu on BP pages 49 if ( !bp_is_blog_page() ) 50 remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 ); 51 52 remove_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 ); 53 remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 ); 54 55 if ( !is_network_admin() && !is_user_admin() ) { 56 remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 ); 57 remove_action( 'admin_bar_menu', 'wp_admin_bar_appearance_menu', 60 ); 58 } 59 60 remove_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 ); 61 } 45 62 } 46 63 add_action( 'bp_init', 'bp_admin_bar_remove_wp_menus', 2 ); … … 91 108 } 92 109 } 93 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_root_site', 3 );94 110 95 111 /** … … 125 141 } 126 142 } 127 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_my_sites_menu', 3 );128 143 129 144 /** … … 142 157 $wp_admin_bar->add_menu( array( 'parent' => 'dashboard', 'id' => 'comments', 'title' => sprintf( __( 'Comments %s' ), $awaiting_mod ), 'href' => admin_url( 'edit-comments.php' ) ) ); 143 158 } 144 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_comments_menu', 3 );145 159 146 160 /** … … 174 188 $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'header', 'title' => __( 'Header' ), 'href' => admin_url( 'themes.php?page=custom-header' ) ) ); 175 189 } 176 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_appearance_menu', 3 );177 190 178 191 /** … … 219 232 $wp_admin_bar->add_menu( array( 'parent' => 'dashboard', 'id' => 'updates', 'title' => $update_title, 'href' => network_admin_url( 'update-core.php' ) ) ); 220 233 } 221 add_action( 'bp_setup_admin_bar', 'bp_admin_bar_updates_menu', 3 );222 234 223 235 /** … … 228 240 229 241 if ( !bp_use_wp_admin_bar() ) 242 return; 243 244 if ( '3.3' == bp_get_major_wp_version() ) 230 245 return; 231 246 … … 249 264 } 250 265 add_action( 'bp_init', 'bp_core_load_admin_bar_css' ); 266 251 267 ?> -
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 ?> -
branches/1.5/bp-members/bp-members-adminbar.php
r5283 r5483 13 13 14 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_members_admin_bar_version_check() { 20 21 if ( '3.2' == bp_get_major_wp_version() ) { 22 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_menu', 4 ); 23 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_notifications_menu', 5 ); 24 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_user_admin_menu', 99 ); 25 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_logout', 9999 ); 26 } elseif ( '3.3' == bp_get_major_wp_version() ) { 27 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_menu', 4 ); 28 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_notifications_menu', 5 ); 29 add_action( 'admin_bar_menu', 'bp_members_admin_bar_user_admin_menu', 400 ); 30 } 31 } 32 add_action( 'admin_bar_menu', 'bp_members_admin_bar_version_check', 4 ); 33 34 /** 15 35 * Add the "My Account" menu and all submenus. 16 36 * … … 18 38 */ 19 39 function bp_members_admin_bar_my_account_menu() { 20 global $bp, $wp_admin_bar ;40 global $bp, $wp_admin_bar, $wp_version; 21 41 22 42 // Bail if this is an ajax request … … 27 47 if ( is_user_logged_in() ) { 28 48 29 // User avatar 30 $avatar = bp_core_fetch_avatar( array( 31 'item_id' => $bp->loggedin_user->id, 32 'email' => $bp->loggedin_user->userdata->user_email, 33 'width' => 16, 34 'height' => 16 35 ) ); 36 37 // Unique ID for the 'My Account' menu 38 $bp->my_account_menu_id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account'; 39 40 // Create the main 'My Account' menu 41 $wp_admin_bar->add_menu( array( 42 'id' => $bp->my_account_menu_id, 43 'title' => $avatar . bp_get_loggedin_user_fullname(), 44 'href' => $bp->loggedin_user->domain 45 ) ); 49 if ( '3.2' == bp_get_major_wp_version() ) { 50 51 // User avatar 52 $avatar = bp_core_fetch_avatar( array( 53 'item_id' => $bp->loggedin_user->id, 54 'email' => $bp->loggedin_user->userdata->user_email, 55 'width' => 16, 56 'height' => 16 57 ) ); 58 59 // Unique ID for the 'My Account' menu 60 $bp->my_account_menu_id = ( ! empty( $avatar ) ) ? 'my-account-with-avatar' : 'my-account'; 61 62 // Create the main 'My Account' menu 63 $wp_admin_bar->add_menu( array( 64 'id' => $bp->my_account_menu_id, 65 'title' => $avatar . bp_get_loggedin_user_fullname(), 66 'href' => $bp->loggedin_user->domain 67 ) ); 68 69 } else { 70 71 // Unique ID for the 'My Account' menu 72 $bp->my_account_menu_id = 'my-account-buddypress'; 73 74 // Create the main 'My Account' menu 75 $wp_admin_bar->add_menu( array( 76 'parent' => 'my-account', 77 'id' => $bp->my_account_menu_id, 78 'href' => $bp->loggedin_user->domain, 79 'group' => true, 80 'meta' => array( 'class' => 'ab-sub-secondary' ) 81 ) ); 82 } 46 83 47 84 // Show login and sign-up links … … 67 104 } 68 105 } 69 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_menu', 4 );70 106 71 107 /** … … 86 122 return false; 87 123 88 // User avatar 89 $avatar = bp_core_fetch_avatar( array( 90 'item_id' => $bp->displayed_user->id, 91 'email' => $bp->displayed_user->userdata->user_email, 92 'width' => 16, 93 'height' => 16 94 ) ); 95 96 // Unique ID for the 'My Account' menu 97 $bp->user_admin_menu_id = ( ! empty( $avatar ) ) ? 'user-admin-with-avatar' : 'user-admin'; 98 99 // Add the top-level User Admin button 100 $wp_admin_bar->add_menu( array( 101 'id' => $bp->user_admin_menu_id, 102 'title' => $avatar . bp_get_displayed_user_fullname(), 103 'href' => bp_displayed_user_domain() 104 ) ); 124 if ( '3.2' == bp_get_major_wp_version() ) { 125 126 // User avatar 127 $avatar = bp_core_fetch_avatar( array( 128 'item_id' => $bp->displayed_user->id, 129 'email' => $bp->displayed_user->userdata->user_email, 130 'width' => 16, 131 'height' => 16 132 ) ); 133 134 // Unique ID for the 'My Account' menu 135 $bp->user_admin_menu_id = ( ! empty( $avatar ) ) ? 'user-admin-with-avatar' : 'user-admin'; 136 137 // Add the top-level User Admin button 138 $wp_admin_bar->add_menu( array( 139 'id' => $bp->user_admin_menu_id, 140 'title' => $avatar . bp_get_displayed_user_fullname(), 141 'href' => bp_displayed_user_domain() 142 ) ); 143 144 } elseif ( '3.3' == bp_get_major_wp_version() ) { 145 146 // Unique ID for the 'My Account' menu 147 $bp->user_admin_menu_id = 'user-admin'; 148 149 // Add the top-level User Admin button 150 $wp_admin_bar->add_menu( array( 151 'id' => $bp->user_admin_menu_id, 152 'title' => __( 'Edit Member', 'buddypress' ), 153 'href' => bp_displayed_user_domain() 154 ) ); 155 } 105 156 106 157 // User Admin > Edit this user's profile … … 148 199 ) ); 149 200 } 150 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_user_admin_menu', 99 );151 201 152 202 /** … … 168 218 } 169 219 170 // Add the top-level Notifications button 171 $wp_admin_bar->add_menu( array( 172 'id' => 'bp-notifications', 173 'title' => $menu_title, 174 'href' => bp_loggedin_user_domain() 175 ) ); 220 if ( '3.2' == bp_get_major_wp_version() ) { 221 222 // Add the top-level Notifications button 223 $wp_admin_bar->add_menu( array( 224 'id' => 'bp-notifications', 225 'title' => $menu_title, 226 'href' => bp_loggedin_user_domain() 227 ) ); 228 229 } elseif ( '3.3' == bp_get_major_wp_version() ) { 230 231 // Add the top-level Notifications button 232 $wp_admin_bar->add_menu( array( 233 'parent' => 'top-secondary', 234 'id' => 'bp-notifications', 235 'title' => $menu_title, 236 'href' => bp_loggedin_user_domain() 237 ) ); 238 } 176 239 177 240 if ( !empty( $notifications ) ) { … … 195 258 return; 196 259 } 197 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_notifications_menu', 999 );198 260 199 261 /** … … 222 284 } 223 285 } 224 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_my_account_logout', 9999 );225 286 226 287 ?>
Note: See TracChangeset
for help on using the changeset viewer.