Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Get Logged-In User Profile Link URL?

@ctyldsley

Participant

Thanks for all of your help everyone!! Finally there, although it’s not the most beautiful thing, it works for this case.

//Shortcode for getting user profile URL
add_shortcode( 'CUSER-PROFILE', 'cuser_profile_shortocode_handler' );
function cuser_profile_shortocode_handler( $atts ){
	$atts = shortcode_atts( array( 
		'text'		=> 'my profile',
	), $atts );
	
	if( !is_user_logged_in() )
		return '';
	
	$link = home_url( '/hbcmembers/' . bp_core_get_username( get_current_user_id() ) . '/profile/' );
	return "<a href='". esc_attr( $link ) ."'>" . "<img src ='". $atts['text'] . "'> </a>";
}

Using the shortcode but rather than inputting text I just input the URL of the image along with it and it links the image.

Skip to toolbar