Changeset 13443 for trunk/src/bp-members/bp-members-adminbar.php
- Timestamp:
- 03/31/2023 05:26:39 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-adminbar.php
r13441 r13443 83 83 84 84 // Only show if viewing a user. 85 if ( ! bp_is_user() )85 if ( ! bp_is_user() ) { 86 86 return false; 87 } 87 88 88 89 // Don't show this menu to non site admins or if you're viewing your own profile. 89 if ( ! current_user_can( 'edit_users' ) || bp_is_my_profile() )90 if ( ! current_user_can( 'edit_users' ) || bp_is_my_profile() ) { 90 91 return false; 92 } 91 93 92 94 $bp = buddypress(); … … 96 98 97 99 // Add the top-level User Admin button. 98 $wp_admin_bar->add_node( array( 99 'id' => $bp->user_admin_menu_id, 100 'title' => __( 'Edit Member', 'buddypress' ), 101 'href' => bp_displayed_user_domain() 102 ) ); 100 $wp_admin_bar->add_node( 101 array( 102 'id' => $bp->user_admin_menu_id, 103 'title' => __( 'Edit Member', 'buddypress' ), 104 'href' => bp_displayed_user_url() 105 ) 106 ); 103 107 104 108 if ( bp_is_active( 'xprofile' ) ) { 105 109 // User Admin > Edit this user's profile. 106 $wp_admin_bar->add_node( array( 107 'parent' => $bp->user_admin_menu_id, 108 'id' => $bp->user_admin_menu_id . '-edit-profile', 109 'title' => __( "Edit Profile", 'buddypress' ), 110 'href' => bp_get_members_component_link( $bp->profile->id, 'edit' ) 111 ) ); 110 $wp_admin_bar->add_node( 111 array( 112 'parent' => $bp->user_admin_menu_id, 113 'id' => $bp->user_admin_menu_id . '-edit-profile', 114 'title' => __( "Edit Profile", 'buddypress' ), 115 'href' => bp_get_members_component_link( $bp->profile->id, 'edit' ), 116 ) 117 ); 112 118 113 119 // User Admin > Edit this user's avatar. 114 120 if ( buddypress()->avatar->show_avatars ) { 115 $wp_admin_bar->add_node( array( 116 'parent' => $bp->user_admin_menu_id, 117 'id' => $bp->user_admin_menu_id . '-change-avatar', 118 'title' => __( "Edit Profile Photo", 'buddypress' ), 119 'href' => bp_get_members_component_link( $bp->profile->id, 'change-avatar' ) 120 ) ); 121 $wp_admin_bar->add_node( 122 array( 123 'parent' => $bp->user_admin_menu_id, 124 'id' => $bp->user_admin_menu_id . '-change-avatar', 125 'title' => __( "Edit Profile Photo", 'buddypress' ), 126 'href' => bp_get_members_component_link( $bp->profile->id, 'change-avatar' ), 127 ) 128 ); 121 129 } 122 130 123 131 // User Admin > Edit this user's cover image. 124 132 if ( bp_displayed_user_use_cover_image_header() ) { 125 $wp_admin_bar->add_node( array( 126 'parent' => $bp->user_admin_menu_id, 127 'id' => $bp->user_admin_menu_id . '-change-cover-image', 128 'title' => __( 'Edit Cover Image', 'buddypress' ), 129 'href' => bp_get_members_component_link( $bp->profile->id, 'change-cover-image' ) 130 ) ); 133 $wp_admin_bar->add_node( 134 array( 135 'parent' => $bp->user_admin_menu_id, 136 'id' => $bp->user_admin_menu_id . '-change-cover-image', 137 'title' => __( 'Edit Cover Image', 'buddypress' ), 138 'href' => bp_get_members_component_link( $bp->profile->id, 'change-cover-image' ), 139 ) 140 ); 131 141 } 132 142 … … 135 145 if ( bp_is_active( 'settings' ) ) { 136 146 // User Admin > Spam/unspam. 137 $wp_admin_bar->add_node( array( 138 'parent' => $bp->user_admin_menu_id, 139 'id' => $bp->user_admin_menu_id . '-user-capabilities', 140 'title' => __( 'User Capabilities', 'buddypress' ), 141 'href' => bp_displayed_user_domain() . 'settings/capabilities/' 142 ) ); 147 $wp_admin_bar->add_node( 148 array( 149 'parent' => $bp->user_admin_menu_id, 150 'id' => $bp->user_admin_menu_id . '-user-capabilities', 151 'title' => __( 'User Capabilities', 'buddypress' ), 152 'href' => bp_get_members_component_link( $bp->settings->id, 'capabilities' ), 153 ) 154 ); 143 155 144 156 // User Admin > Delete Account. 145 $wp_admin_bar->add_node( array(146 'parent' => $bp->user_admin_menu_id,147 'id' => $bp->user_admin_menu_id . '-delete-user',148 'title' => __( 'Delete Account', 'buddypress' ),149 'href' => bp_displayed_user_domain() . 'settings/delete-account/'150 ) );151 152 }153 157 $wp_admin_bar->add_node( 158 array( 159 'parent' => $bp->user_admin_menu_id, 160 'id' => $bp->user_admin_menu_id . '-delete-user', 161 'title' => __( 'Delete Account', 'buddypress' ), 162 'href' => bp_get_members_component_link( $bp->settings->id, 'delete-account' ), 163 ) 164 ); 165 } 154 166 } 155 167 add_action( 'admin_bar_menu', 'bp_members_admin_bar_user_admin_menu', 99 );
Note: See TracChangeset
for help on using the changeset viewer.