Changeset 12924
- Timestamp:
- 04/28/2021 11:51:37 PM (3 years ago)
- Location:
- trunk/src/bp-members
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-adminbar.php
r12892 r12924 24 24 25 25 // Bail if this is an ajax request. 26 if ( defined( 'DOING_AJAX' ) )26 if ( wp_doing_ajax() ) { 27 27 return; 28 } 28 29 29 30 // Logged in user. … … 179 180 } 180 181 add_action( 'add_admin_bar_menus', 'bp_members_remove_edit_page_menu' ); 182 183 /** 184 * Add the "Invitations" menu and submenus. 185 * 186 * @since 8.0.0 187 */ 188 function bp_members_admin_bar_add_invitations_menu() { 189 global $wp_admin_bar; 190 191 // Bail if this is an ajax request. 192 if ( wp_doing_ajax() ) { 193 return; 194 } 195 196 if ( is_user_logged_in() && bp_get_members_invitations_allowed() && ( bp_current_user_can( 'bp_members_send_invitation' ) || bp_members_invitations_user_has_sent_invites() ) ) { 197 $bp = buddypress(); 198 $invitations_link = trailingslashit( bp_loggedin_user_domain() . bp_get_members_invitations_slug() ); 199 200 $wp_admin_bar->add_node( 201 array( 202 'id' => $bp->my_account_menu_id . '-invitations', 203 'parent' => $bp->my_account_menu_id, 204 'title' => __( 'Invitations', 'buddypress' ), 205 'href' => $invitations_link, 206 'meta' => array( 207 'class' => 'ab-sub-secondary' 208 ) 209 ) 210 ); 211 212 if ( bp_current_user_can( 'bp_members_send_invitation' ) ) { 213 $wp_admin_bar->add_node( 214 array( 215 'id' => $bp->my_account_menu_id . '-invitations-send', 216 'parent' => $bp->my_account_menu_id . '-invitations', 217 'title' => __( 'Send Invites', 'buddypress' ), 218 'href' => $invitations_link, 219 'meta' => array( 220 'class' => 'ab-sub-secondary' 221 ) 222 ) 223 ); 224 } 225 226 $wp_admin_bar->add_node( 227 array( 228 'id' => $bp->my_account_menu_id . '-invitations-list', 229 'parent' => $bp->my_account_menu_id . '-invitations', 230 'title' => __( 'Pending Invites', 'buddypress' ), 231 'href' => $invitations_link . 'list-invites/', 232 'meta' => array( 233 'class' => 'ab-sub-secondary' 234 ) 235 ) 236 ); 237 } 238 } 239 add_action( 'bp_setup_admin_bar', 'bp_members_admin_bar_add_invitations_menu', 90 ); -
trunk/src/bp-members/classes/class-bp-members-component.php
r12920 r12924 561 561 'position' => 40 562 562 ); 563 } 564 565 return $wp_admin_nav; 566 } 567 568 /** 569 * Get the members invitations admin bar navs. 570 * 571 * @since 8.0.0 572 * 573 * @param string $admin_bar_menu_id The Admin bar menu ID to attach sub items to. 574 * @return array The members invitations admin navs. 575 */ 576 public function get_members_invitations_admin_navs( $admin_bar_menu_id = '' ) { 577 $wp_admin_nav = array(); 578 $invite_link = trailingslashit( bp_loggedin_user_domain() . bp_get_profile_slug() ); 579 580 if ( ! $admin_bar_menu_id ) { 581 $admin_bar_menu_id = $this->id; 563 582 } 564 583
Note: See TracChangeset
for help on using the changeset viewer.