bp_ps_xprofile_setup( $fields )

Setup BuddyBoss Profile Search Extended fields.

Description

Source

File: bp-core/profile-search/bps-xprofile.php

function bp_ps_xprofile_setup ($fields)
{
	global $group, $field;

	$args = array ('hide_empty_fields' => false, 'member_type' => bp_get_member_types ());
	if (bp_has_profile ($args))
	{
		while (bp_profile_groups ())
		{
			bp_the_profile_group ();
			$group_name = str_replace ('&', '&', stripslashes ($group->name));

			while (bp_profile_fields ())
			{
				bp_the_profile_field ();
				$f = new stdClass;

				$f->group = $group_name;
				$f->id = $field->id;
				$f->code = 'field_'. $field->id;
				$f->name = str_replace ('&', '&', stripslashes ($field->name));
				$f->name = $f->name;
				$f->description = str_replace ('&', '&', stripslashes ($field->description));
				$f->description = $f->description;
				$f->type = $field->type;

				$f->format = bp_ps_xprofile_format ($field->type, $field->id);
				$f->search = 'bp_ps_xprofile_search';
				$f->sort_directory = 'bp_ps_xprofile_sort_directory';
				$f->get_value = 'bp_ps_xprofile_get_value';

				$f->options = bp_ps_xprofile_options ($field->id);
				foreach ($f->options as $key => $label)
					$f->options[$key] = $label;

				if ($f->format == 'custom')
					/**
					 * @todo add title/description
					 *
					 * @since BuddyBoss 1.0.0
					 */
					do_action ('bp_ps_custom_field', $f);

				if ($f->format == 'set')
					unset ($f->sort_directory, $f->get_value);

				$fields[] = $f;
			}
		}
	}

	return $fields;
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.