Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to display a custom field?

@stilld

Participant

Hi Shanebp!

Yeah, I tried the xprofile_get_field_data suggestion, but this also doesn’t work for me…

I’ve got this in bp-custom.php:

<?php

//Add Location field to header if user has entered data into it
//Nothing is shown if user hasn't entered anything into field
function bptest_show_opleiding_field () {
	$opleiding_field = bp_get_member_profile_data( 'field=Opleiding' ); 
	if ( ! $opleiding_field  ) { 
	   return; 
	}   
	else {
	   echo '<span class="custom-field-text">' . $opleiding_field . '</span>'; 
	}
}
//user_bio_location_field is used within the member-header php template file
add_action ( 'user_opleiding_field', 'bptest_show_opleiding_field' );

?>

and this in order.php in the Learnpress plugin:

<div id="user-opleiding">
Opleiding: <?php 
$user_id = bp_loggedin_user_id();
$opleiding_field = xprofile_get_field_data( 'Opleiding', bp_loggedin_user_id(), $multi_format = 'comma' );
?>
</div>

I looked at the url you have send, but I am not able to figure out how to use this, unfortunately. Maybe you have another suggestion for me to try?

Sorry if I’m bordering you guys too much! I hope you are able to figure this one out with me 🙂 It would mean a lot!

David

Skip to toolbar