bp_members_admin_bar_user_admin_menu ()
将User Admin顶级菜单添加到用户页面。
描述
源
文件:bp-members / bp-members-adminbar.php
函数bp_members_admin_bar_user_admin_menu(){全局$wp_admin_bar;//仅在查看用户时显示。If (!bp_is_user())返回false;//不要将此菜单显示给非站点管理员或正在查看自己的配置文件的用户。If (!current_user_can('edit_users') || bp_is_my_profile())返回false;英国石油美元= buddypress ();//“My Account”菜单的唯一ID。英国石油(bp) - > user_admin_menu_id =“user-admin”;$user = get_userdata(bp_displayed_user_id());$link = BP_Core_Members_Switching::maybe_switch_url($user); // Add the top-level User Admin button. $wp_admin_bar->add_menu( array( 'id' => $bp->user_admin_menu_id, 'title' => __( 'Edit Member', 'buddyboss' ), 'href' => add_query_arg( [ 'redirect_to' => urlencode( bp_get_members_component_link( 'profile', 'edit' ) ), ], $link ) ) ); if ( bp_is_active( 'xprofile' ) ) { // User Admin > Edit this user's profile. $wp_admin_bar->add_menu( array( 'parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-edit-profile', 'title' => __( 'Edit Profile', 'buddyboss' ), 'href' => add_query_arg( [ 'redirect_to' => urlencode( bp_get_members_component_link( 'profile', 'edit' ) ), ], $link ) ) ); // User Admin > Edit this user's avatar. if ( buddypress()->avatar->show_avatars ) { $wp_admin_bar->add_menu( array( 'parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-change-avatar', 'title' => __( 'Edit Profile Photo', 'buddyboss' ), 'href' => add_query_arg( [ 'redirect_to' => urlencode( bp_get_members_component_link( 'profile', 'change-avatar' ) ), ], $link ) ) ); } // User Admin > Edit this user's cover photo. if ( bp_displayed_user_use_cover_image_header() ) { $wp_admin_bar->add_menu( array( 'parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-change-cover-image', 'title' => __( 'Edit Cover Photo', 'buddyboss' ), 'href' => add_query_arg( [ 'redirect_to' => urlencode( bp_get_members_component_link( 'profile', 'change-cover-image' ) ), ], $link ) ) ); } } if ( bp_is_active( 'settings' ) ) { // User Admin > Spam/unspam. // $wp_admin_bar->add_menu( array( // 'parent' => $bp->user_admin_menu_id, // 'id' => $bp->user_admin_menu_id . '-user-capabilities', // 'title' => __( 'User Capabilities', 'buddyboss' ), // 'href' => add_query_arg( [ // 'redirect_to' => urlencode( bp_displayed_user_domain() . 'settings/capabilities/' ), // ], $link ) // ) ); // User Admin > Delete Account. $wp_admin_bar->add_menu( array( 'parent' => $bp->user_admin_menu_id, 'id' => $bp->user_admin_menu_id . '-delete-user', 'title' => __( 'Delete Account', 'buddyboss' ), 'href' => add_query_arg( [ 'redirect_to' => urlencode( bp_displayed_user_domain() . 'settings/delete-account/' ), ], $link ) ) ); } }
更新日志
版本 | 描述 |
---|---|
BuddyPress 1.5.0 | 介绍了。 |