Changeset 5289 for trunk/bp-members/bp-members-adminbar.php
- Timestamp:
- 11/06/2011 06:52:09 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-adminbar.php
r5282 r5289 39 39 // Backward-compatibility will be deprecated at some point. 40 40 if ( version_compare( (float)$wp_version, '3.3', '>=' ) ) { 41 41 42 // Stored in the global so we can add menus easily later on 42 $bp->my_account_menu_id = 'my-account ';43 $bp->my_account_menu_id = 'my-account-buddypress'; 43 44 44 45 $title = bp_get_loggedin_user_fullname() . $avatar; … … 182 183 return false; 183 184 184 if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id(), 'object' ) ) { 185 $menu_title = sprintf( __( 'Notifications <span id="ab-pending-notifications" class="pending-count">%s</span>', 'buddypress' ), count( $notifications ) ); 186 } else { 187 $menu_title = __( 'Notifications', 'buddypress' ); 188 } 185 $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id(), 'object' ); 186 $count = !empty( $notifications ) ? count( $notifications ) : '0'; 187 $alert_class = (int) $count > 0 ? 'pending-count alert' : 'count no-alert'; 188 $menu_title = '<span id="ab-pending-notifications" class="' . $alert_class . '">' . $count . '</span>'; 189 189 190 190 // Add the top-level Notifications button … … 192 192 'id' => 'bp-notifications', 193 193 'title' => $menu_title, 194 'href' => bp_loggedin_user_domain() 194 'href' => bp_loggedin_user_domain(), 195 'meta' => array( 196 'class' => 'opposite', 197 ) 195 198 ) ); 196 199 … … 217 220 add_action( 'admin_bar_menu', 'bp_members_admin_bar_notifications_menu', 90 ); 218 221 219 /**220 * Make sure the logout link is at the bottom of the "My Account" menu221 *222 * @since BuddyPress (r4151)223 *224 * @global obj $bp225 * @global obj $wp_admin_bar226 */227 function bp_members_admin_bar_my_account_logout() {228 global $bp, $wp_admin_bar;229 230 // Bail if this is an ajax request231 if ( defined( 'DOING_AJAX' ) )232 return;233 234 if ( is_user_logged_in() ) {235 // Log out236 $wp_admin_bar->add_menu( array(237 'parent' => $bp->my_account_menu_id,238 'id' => $bp->my_account_menu_id . '-logout',239 'title' => __( 'Log Out', 'buddypress' ),240 'href' => wp_logout_url()241 ) );242 }243 }244 add_action( 'admin_bar_menu', 'bp_members_admin_bar_my_account_logout', 9999 );245 246 222 ?>
Note: See TracChangeset
for help on using the changeset viewer.