Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change ‘Edit Profile’ link in ‘Edit Member’ menu in admin bar


  • John
    Participant

    @jhob

    Is it possible to change the ‘Edit Profile’ link that appears in the ‘Edit Member’ menu in the WordPress admin bar? screenshot

    I want to change this to link to the user profile page in admin.

    I would also like to remove ‘Edit Profile Photo’ and ‘User Capabilities’ menu items if that’s possible.

    BP:3.2.0, WP:4.9.8

    Thanks,
    John

Viewing 2 replies - 1 through 2 (of 2 total)

  • Prashant Singh
    Participant

    @prashantvatsh

    Hi,

    Please try this snippet:

    add_action( 'wp_before_admin_bar_render', 'ps_changed_admin_bar' ); 
    
    function ps_changed_admin_bar() {
        global $wp_admin_bar;
    
        $wp_admin_bar->remove_menu('edit-profile');
    
        $wp_admin_bar->add_menu( array(
                'id'    => 'edit-profile',
                'title' => 'Edit Zee Profile',
                'href'  => admin_url('profile.php'),
                'parent'=>'user-actions'
            ));
    }

    Hopefully, it will help you.


    John
    Participant

    @jhob

    Hi Prashant,

    That didn’t quite work but it did get me thinking along the right lines and I’ve come up with a solution:

    
    add_action( 'wp_before_admin_bar_render', 'add_edit_member_menu' );
    
    function add_edit_member_menu() {
    	global $wp_admin_bar;
    	$user_id = bp_displayed_user_id();
    	if ( ! empty( $user_id ) ) {
    		$wp_admin_bar->remove_menu( 'user-admin' );
    		$wp_admin_bar->add_menu( array(
    			'id'    => 'edit-member',
    			'title' => 'Edit Member',
    			'href'  => admin_url( 'user-edit.php?user_id=' . $user_id ),
    			'meta'  => array(
    				'title' => __( 'Edit Member' ),
    			),
    		) );
    	}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar