Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to display a custom field?

@mcuk

Participant

Hi,

Not used LearnPress so unable to comment much on that . The method I used to insert/display my own custom profile fields into a header on the user activity page was as follows (in this case, a Location field which was created in the WP dashboard).

1. Add to bp-custom.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_location_field () {
	$location_field = bp_get_member_profile_data( 'field=Location' ); 
	if ( ! $location_field  ) { 
	   return; 
	}   
	else {
	   echo '<span class="custom-field-text">' . $location_field . '</span>'; 
	}
}
//user_bio_location_field is used within the member-header php template file
add_action ( 'user_location_field', 'bptest_show_location_field' );

2. In my member-header.php file (which was copied into my child theme) entered the div :

<div id="user-location">
	<?php 
		do_action ( 'user_location_field' ); 
	?>
</div><!-- #user-location - function is found in bp-custom -->

Obviously the php code in step two is placed wherever you want the field to display, just put it in the correct location of the correct php file. In my case it was member-header.php but for you i’m guessing its the one that generates your order page?.

Not sure if you have already tried any of that or if it even helps!

Skip to toolbar