/** * Add the User Admin top-level menu to user pages. * * @since 1.5.0 */ function bp_members_admin_bar_user_admin_menu() { global $wp_admin_bar; // Only show if viewing a user. if (!bp_is_user()) { return false; } // Don't show this menu to non site admins or if you're viewing your own profile. if (!current_user_can('edit_users') || bp_is_my_profile()) { return false; } $bp = buddypress(); // Unique ID for the 'My Account' menu. $bp->user_admin_menu_id = 'user-admin'; // Add the top-level User Admin button. $wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => __('Edit Member', 'buddypress'), 'href' => bp_displayed_user_domain())); 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", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit'))); // 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", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar'))); } // User Admin > Edit this user's cover image. 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 Image', 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-cover-image'))); } } 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', 'buddypress'), 'href' => bp_displayed_user_domain() . 'settings/capabilities/')); // 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', 'buddypress'), 'href' => bp_displayed_user_domain() . 'settings/delete-account/')); } }
<?php /** * Fires before the display of member home content. * * @since 1.2.0 */ do_action('bp_before_member_home_content'); ?> <div id="item-header" role="complementary"> <?php /** * If the cover image feature is enabled, use a specific header */ if (bp_displayed_user_use_cover_image_header()) { bp_get_template_part('members/single/cover-image-header'); } else { bp_get_template_part('members/single/member-header'); } ?> </div><!-- #item-header --> <div id="item-nav"> <div class="item-list-tabs no-ajax" id="object-nav" aria-label="<?php esc_attr_e('Member primary navigation', 'buddypress'); ?> " role="navigation"> <ul>
/** * Set up the Admin Bar. * * @param array $wp_admin_nav Admin Bar items. */ public function setup_admin_bar($wp_admin_nav = array()) { // Menus for logged in user. if (is_user_logged_in()) { // Profile link. $profile_link = trailingslashit(bp_loggedin_user_domain() . bp_get_profile_slug()); // Add the "Profile" sub menu. $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x('Profile', 'My Account Profile', 'buddypress'), 'href' => $profile_link); // View Profile. $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-public', 'title' => _x('View', 'My Account Profile sub nav', 'buddypress'), 'href' => $profile_link); // Edit Profile. $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-edit', 'title' => _x('Edit', 'My Account Profile sub nav', 'buddypress'), 'href' => trailingslashit($profile_link . 'edit')); // Edit Avatar. if (buddypress()->avatar->show_avatars) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-change-avatar', 'title' => _x('Change Profile Photo', 'My Account Profile sub nav', 'buddypress'), 'href' => trailingslashit($profile_link . 'change-avatar')); } if (bp_displayed_user_use_cover_image_header()) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-change-cover-image', 'title' => _x('Change Cover Image', 'My Account Profile sub nav', 'buddypress'), 'href' => trailingslashit($profile_link . 'change-cover-image')); } } parent::setup_admin_bar($wp_admin_nav); }
//get_header( $template_type ); if ($template_type == 'buddypress') { //load buddypress markup if (bp_displayed_user_id()) { //if it is a buddypress member profile ?> <?php do_action('bp_before_member_home_content'); ?> <div id="item-header" role="complementary"> <?php /** * If the cover image feature is enabled, use a specific header */ if (function_exists('bp_displayed_user_use_cover_image_header') && bp_displayed_user_use_cover_image_header()) { bp_get_template_part('members/single/cover-image-header'); } else { bp_get_template_part('members/single/member-header'); } ?> </div><!--#item-header--> <div id="item-nav"> <div class="item-list-tabs no-ajax" id="object-nav" role="navigation"> <ul> <?php bp_get_displayed_user_nav(); ?>