Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to use bp_member_profile_data when its type URL

@danbp

Participant

Hi

instead using a link field type, use a normal text box and harcode the link to social account in the function. That way, the user has only to enter his account name and the link is build when the data is on front-end.

profile fields are stripped
profile datas are made clickable by default for search purpose in BP
We don’t want this for icons or when linking to a social network.

Here an usage example which use fontawesome to add the icons. That the general idea, change it to your need.

function bpfr_socialize_profile () {	

echo '<br>'; 

if ( $data = bp_get_profile_field_data( 'field=Twitter ' ) ) : 
?>

<a href="http://twitter.com/<?php echo xprofile_get_field_data( 'Twitter', bp_displayed_user_id() );?>/" target="_blank" title="Twitter"><i class="icon-twitter"></i><?php echo $data; ?></a>&nbsp;

<?php endif;

if ( $data = bp_get_profile_field_data( 'field=Facebook ' ) ) : 
?>

<a href="http://facebook.com/<?php echo xprofile_get_field_data( 'Facebook', bp_displayed_user_id() );?>/" target="_blank" title="Facebook"><i class="icon-facebook"></i><?php echo $data; ?></a>		

<?php		
endif;
}
add_filter( 'bp_before_member_header_meta', 'bpfr_socialize_profile' );
Skip to toolbar