bp_get_the_profile_field_options( array $args = array() )

Retrieves field options HTML for field types of ‘selectbox’, ‘multiselectbox’, ‘radio’, ‘checkbox’, and ‘datebox’.

Description

Parameters

$args

(array) (Optional) Array of optional arguments.

  • 'type'
    (string|bool) Type of datebox. False if it's not a datebox, otherwise 'day, 'month', or 'year'. Default: false.
  • 'user_id'
    (int) ID of the user whose profile values should be used when rendering options. Default: displayed user.

Default value: array()

Return

(string) $vaue Field options markup.

Source

File: bp-xprofile/bp-xprofile-template.php

	function bp_get_the_profile_field_options( $args = array() ) {
		global $field;

		$args = bp_parse_args( $args, array(
			'type'    => false,
			'user_id' => bp_displayed_user_id(),
		), 'get_the_profile_field_options' );

		/**
		 * In some cases, the $field global is not an instantiation of the BP_XProfile_Field class.
		 * However, we have to make sure that all data originally in $field gets merged back in, after reinstantiation.
		 */
		if ( ! method_exists( $field, 'get_children' ) ) {
			$field_obj = xprofile_get_field( $field->id );

			foreach ( $field as $field_prop => $field_prop_value ) {
				if ( ! isset( $field_obj->{$field_prop} ) ) {
					$field_obj->{$field_prop} = $field_prop_value;
				}
			}

			$field = $field_obj;
		}

		ob_start();
		$field->type_obj->edit_field_options_html( $args );
		$html = ob_get_contents();
		ob_end_clean();

		return $html;
	}

Changelog

Changelog
Version Description
BuddyPress 1.1.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.