BP_XProfile_Field_Type::set_whitelist_values( string|array $values )

Add a value to this type’s whitelist that profile data will be asserted against.

Description

You can call this method multiple times to set multiple formats. When validation is performed, it’s successful as long as the new value matches any one of the registered formats.

Parameters

$values

(string|array) (Required) Whitelisted values.

Return

(BP_XProfile_Field_Type)

Source

File: bp-xprofile/classes/class-bp-xprofile-field-type.php

	public function set_whitelist_values( $values ) {
		foreach ( (array) $values as $value ) {

			/**
			 * Filters values for field type's whitelist that profile data will be asserted against.
			 *
			 * @since BuddyPress 2.0.0
			 *
			 * @param string                 $value  Field value.
			 * @param array                  $values Original array of values.
			 * @param BP_XProfile_Field_Type $this   Current instance of the BP_XProfile_Field_Type class.
			 */
			$this->validation_whitelist[] = apply_filters( 'bp_xprofile_field_type_set_whitelist_values', $value, $values, $this );
		}

		return $this;
	}

Changelog

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