How do I enter "username" into an URL?

How do I make this work please?

https://christiangays.com/members/username/profile/edit/group/1/

I believe that I need to do something with "username"

Thank you.

  • Nastia

    Hello @mary13

    I hope you are well!

    I'm guessing that you wish to create the "Edit Group" button, right? So each user with correct capabilities could change the group's information.

    I'm afraid there is no simple way to do this, this requires a custom coding and is beyond the scope of support we can provide in these forums.

    Please feel free to post a new job in our Jobs & Pros section on https://premium.wpmudev.org/wordpress-development/ so that a skilled developer can do that for you.

    Let us know if you require any further information!

    Kind Regards,
    Nastia

  • Mary

    <<I'm guessing that you wish to create the "Edit Group" button, right? So each user with correct capabilities could change the group's information.>>

    No, absolutely NOTHING like that! I am not using groups, not trying to make a button and don't want anyone changing anything other than their own profile.

    I simply want to know the link that I put on a page or in an email to take my members to edit their BuddyPress Profiles.

    I know that the link to put them into the backend dashboard is https://christiangays.com/wp-admin/users.php?page=bp-profile-edit

    but I don't want them going to the back end. I want them to edit their profiles in the front end.

    What link do I use to send a member to Edit their BP Profile?

  • Panos

    Hello @mary13,

    This depends where you need to use this link, like inside the content of page, or in a widget, or perhaps hardcoded in a file of your theme.

    In case you want to include this link inside a page you created in your admin you will need to create a shortcode and then insert that shortcode in that page. You can create a simple shortcode by adding the following in your child-theme's functions.php file

    add_shortcode( 'bp_user_profile_link', 'bp_user_profile_link_shortocode' );
    function bp_user_profile_link_shortocode( $atts ){
    	$atts = shortcode_atts( array(
    		'text'		=> 'Profile',
    	), $atts );
    
    	if( !is_user_logged_in() )
    		return '';
    
    	return "<a href='". bp_loggedin_user_domain() ."'>" . $atts['text'] . "</a>";
    }

    And then insert this shortcode
    [bp_user_profile_link text="Profile"]

    You can also search the web for any plugins that supply this type of shortcodes.

    If you want to insert the profile link in a theme's file (like the header.php) you can use something like the following:

    if ( is_user_logged_in() ) {
    <a href="<?php echo bp_loggedin_user_domain(); ?>">Profile</a>
    }

    Hope this helps!

    Kind regards,
    Panos

  • Panos

    Hello @mary13,

    You can replace the snippet in your functions.php with the following:

    add_shortcode( 'bp_user_profile_link', 'bp_user_profile_link_shortocode' );
    function bp_user_profile_link_shortocode( $atts ){
    	$atts = shortcode_atts( array(
    		'text'		=> 'Profile',
    		'target'  => ''
    	), $atts );
    
    	if( !is_user_logged_in() )
    		return '';
    
    	$target_link = bp_loggedin_user_domain();
    
    	switch( $atts['target'] ){
    		case 'settings' : $target_link .= 'settings/'; break;
    		case 'profile'  : $target_link .= 'profile/'; break;
    		case 'edit_profile'  : $target_link .= 'profile/edit/'; break;
    	}
    
    	return "<a href='" . $target_link . "'>" . $atts['text'] . "</a>";
    }

    Now this gives you the chance to choose in which profile link you want to target. So

    1) For the main member page (activity) use the following shortcode:
    [bp_user_profile_link text="Profile" ]

    2) For the Profile page
    [bp_user_profile_link text="Profile" target="profile"]

    3) For the Edit Profile page
    [bp_user_profile_link text="Profile" target="edit_profile"]

    4) For the Settings page
    [bp_user_profile_link text="Profile" target="settings"]

    Hope you find this helpful!

    Kind regards,
    Panos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.