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 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.


Top ↑

Parameters Parameters

$field_value

(mixed) (Required) Submitted field value.

$field_id

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

Default value: ''


Top ↑

Return Return

(mixed)


Source Source

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

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Added the $field_id parameter.
2.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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