buddypress member directory add xprofile field plugin code example
Example 1: buddypress member directory add xprofile field
function my_directory() {
if ( bp_is_active( 'xprofile' ) )
if ( $memberfax = xprofile_get_field_data( 'Fax', bp_get_member_user_id() ) ) :
echo '<br/><div class="Fax">';
echo $memberfax;
echo '</div>';
endif;
}
add_filter ( 'bp_directory_members_item', 'my_directory' );
Example 2: buddypress member directory add xprofile field
add_action( 'bp_directory_members_item', 'bpex_add_profile_field_data' );
function bpex_add_profile_field_data() {
$field_data = xprofile_get_field( $field_id, bp_member_user_id(), true );
$field_value = $value->data->value;
echo '<span>' . $field_value . '</span>';
}
Example 3: buddypress member directory add xprofile field
$field_data = xprofile_get_field( $field_id, $user_id, true );
$field_value = $value->data->value;