BP_XProfile_Field_Type::pre_validate_filter( mixed $field_value, string|int $field_id = '' )

Allow field types to modify submitted values before they are validated.

Description

In some cases, it may be appropriate for a field type to catch submitted values and modify them before they are passed to the is_valid() method. For example, URL validation requires the ‘http://’ scheme (so that the value saved in the database is always a fully-formed URL), but in order to allow users to enter a URL without this scheme, BP_XProfile_Field_Type_URL prepends ‘http://’ when it’s not present.

By default, this is a pass-through method that does nothing. Only override in your own field type if you need this kind of pre- validation filtering.

Parameters

$field_value

(mixed) (Required) Submitted field value.

$field_id

(string|int) (Optional) ID of the field.

Default value: ''

Return

(mixed)

Source

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

	public static function pre_validate_filter( $field_value, $field_id = '' ) {
		return $field_value;
	}

Changelog

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