bp_get_the_profile_field_options( array $args = array() )

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


Parameters 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()


Top ↑

Return Return

(string) $vaue Field options markup.


Source 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, null, false );

			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;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.