This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: How to show BP Xprofile fields in user results – Part 2

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to show BP Xprofile fields in user results – Part 2 Reply To: How to show BP Xprofile fields in user results – Part 2

#47583
TrinerTriner
Participant

Hmm, you’re right, it looks like the IP has changed. Sorry!
Great news, thank you! Do I still need the custom snippet with the latest version of the plugin? If so, can I leave it as it is at the moment?

add_filter('asp_user_advanced_field_value', 'asp_xprofile_user_advanced_field_value', 10, 3);
function asp_xprofile_user_advanced_field_value($value, $field, $user) {
	
	if ( empty($value) ) {
        global $bp;
       
        $args = array(
			'field'   => $field,
			'user_id' => $user->id
		);
		$data = bp_get_profile_field_data($args);

		if ( !empty($data) ) {
			 var_dump($data);
			return $data;
		}
    }
    
    return $value;
}