Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to display a custom field?

@stilld

Participant

Got one question now that I’m working with the provided code:

Do you have tips for using this code for multiple custom fields? How should I edit this code in bp-custom.php if I want to add multiple custom fields?

<?php

function bptest_show_education_field () {
	$user_id = bp_loggedin_user_id();
	$education_field = xprofile_get_field_data( 'Highest Education Grade', bp_loggedin_user_id(), $multi_format = 'comma' );
	if ( ! $education_field  ) { 
	   return; 
	}   
	else {
        echo 'Hoogste opleiding: ' . $education_field . '<br />'; 
	}
}
add_action ( 'user_education_field', 'bptest_show_education_field' );
?>

I’m now trying to copy this code for every custom field, but that’s not really a clean way of doing this. And it’s not working either. Hope you can help me out with this one as well!

Skip to toolbar