bp_xprofile_set_field_data_pre_validate

Filter the raw submitted profile field value.

Description

apply_filters( 'bp_xprofile_set_field_data_pre_validate', (mixed) $value, (BP_XProfile_Field) $field, (BP_XProfile_Field_Type) $field_type_obj ); 

Use this filter to modify the values submitted by users before doing field-type-specific validation.

Parameters (3)

0. $value (mixed)
Value passed to xprofile_set_field_data().
1. $field (BP_XProfile_Field)
Field object.
2. $field_type_obj (BP_XProfile_Field_Type)
The field type obj.

Usage

To run the hook, copy the example below.
  1. $value = apply_filters( 'bp_xprofile_set_field_data_pre_validate', $value, $field, $field_type_obj ); 
  2.  
  3. if ( !empty( $value ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_xprofile_set_field_data_pre_validate callback 
  2. function filter_bp_xprofile_set_field_data_pre_validate( $value, $field, $field_type_obj ) { 
  3. // make filter magic happen here... 
  4. return $value
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_xprofile_set_field_data_pre_validate', 'filter_bp_xprofile_set_field_data_pre_validate', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_xprofile_set_field_data_pre_validate', 'filter_bp_xprofile_set_field_data_pre_validate', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/bp-xprofile/bp-xprofile-functions.php  
  1. $value = apply_filters( 'bp_xprofile_set_field_data_pre_validate', $value, $field, $field_type_obj );