Changeset 4620 for trunk/bp-members/bp-members-adminbar.php
- Timestamp:
- 07/06/2011 07:10:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-members/bp-members-adminbar.php
r4586 r4620 73 73 * @since 1.3 74 74 */ 75 function bp_members_ user_admin_menu() {75 function bp_members_admin_bar_user_admin_menu() { 76 76 global $bp, $wp_admin_bar; 77 77 … … 146 146 ) ); 147 147 } 148 add_action( 'bp_setup_admin_bar', 'bp_members_user_admin_menu', 99 ); 148 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_user_admin_menu', 99 ); 149 150 /** 151 * Build the "Notifications" dropdown 152 * 153 * @package Buddypress 154 * @since 1.3 155 */ 156 function bp_members_admin_bar_notifications_menu() { 157 global $bp, $wp_admin_bar; 158 159 if ( !is_user_logged_in() ) 160 return false; 161 162 if ( $notifications = bp_core_get_notifications_for_user( bp_loggedin_user_id(), 'object' ) ) { 163 $menu_title = sprintf( __( 'Notifications <span id="ab-pending-notifications" class="pending-count">%s</span>', 'buddypress' ), count( $notifications ) ); 164 } else { 165 $menu_title = __( 'Notifications', 'buddypress' ); 166 } 167 168 // Add the top-level Notifications button 169 $wp_admin_bar->add_menu( array( 170 'id' => 'notifications', 171 'title' => $menu_title, 172 'href' => bp_loggedin_user_domain() 173 ) ); 174 175 if ( !empty( $notifications ) ) { 176 foreach ( (array)$notifications as $notification ) { 177 $wp_admin_bar->add_menu( array( 178 'parent' => 'notifications', 179 'id' => 'notification-' . $notification->id, 180 'title' => $notification->content, 181 'href' => $notification->href 182 ) ); 183 } 184 } else { 185 $wp_admin_bar->add_menu( array( 186 'parent' => 'notifications', 187 'id' => 'no-notifications', 188 'title' => __( 'No new notifications', 'buddypress' ), 189 'href' => bp_loggedin_user_domain() 190 ) ); 191 } 192 193 return; 194 } 195 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_notifications_menu', 999 ); 149 196 150 197 /**
Note: See TracChangeset
for help on using the changeset viewer.