BuddyDev

Search

Make avatar in profile a link to change photo

Tagged: 

  • Participant
    Level: Initiated
    Posts: 10
    demonboy on #25966

    Hi,

    I would like to remove the Profile tab (done already) but this also hides the ‘change picture’ link. How do I make the avatar a clickable link to the change profile page?

    Cheers

  • Participant
    Level: Initiated
    Posts: 10
    demonboy on #25967

    An alternative would be to add a submenu to the ‘settings’ page. I’m looking into this (sorry, couldn’t edit my OP).

  • Participant
    Level: Initiated
    Posts: 10
    demonboy on #25968

    OK, I copied some code from the web which created an activity link in the Activity tab. I’ve changed what I can so the submenu appears in the Settings tab instead, but I need to change the ‘screen function’ and the ‘link’ part to point to the Change Image page. Any pointers?

    function bpfr_custom_profile_sub_nav() {
    	global $bp;
    	$parent_slug = 'settings';
    		
    	//Add subnav item 	 
    	bp_core_new_subnav_item( array( 
    	'name'            => __( 'Change Photo' ), 
    	'slug'            => $parent_slug, 
    	'parent_url'      => $bp->loggedin_user->domain . $parent_slug.'/', 
    	'parent_slug'     => $parent_slug, 
    	'screen_function' => 'bp_activity_screen_my_activity',
    	'position'        => 60,
    	'link'            => bp_get_activity_directory_permalink(),
    	) );
    }
    add_action( 'bp_setup_nav', 'bpfr_custom_profile_sub_nav' );
  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #25974

    Please change your ‘link’ to this

    
    'link'            => bp_displayed_user_domain() .bp_get_profile_slug() .'/change-avatar/',
    

    That will do it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    demonboy on #25977

    Hi Brajesh,

    We’re almost there. The link you provided worked (for some reason I had to put it in my functions file, not bp-custom, to make it work), but only when the Profiles tab is displaying because it jumps from the Settings tab to the Profile tab to bring up the image upload window. However I want to hide the Profiles tab altogether with this code:

    function vap_remove_buddypress_profile_tabs() {
    	global $bp;
           // to remove main menu like friends.
            bp_core_remove_nav_item('profile' );
           // to remove sub nav favorites under activity.
           bp_core_remove_subnav_item('activity', 'favorites');
    }
    add_action( 'bp_setup_nav', 'vap_remove_buddypress_profile_tabs', 999 );

    When I remove the Profiles tab Buddypress doesn’t know where to go after clicking ‘change photos’ when in the Settings tab.

You must be logged in to reply to this topic.

This topic is: not resolved