xprofile_field_options_before_save

Filters the submitted field option value before saved.

Description

apply_filters( 'xprofile_field_options_before_save', (string) $post_option, (BP_XProfile_Field) $this_type ); 

Parameters (2)

0. $post_option (string)
Submitted option value.
1. $this_type (BP_XProfile_Field)
Current field type being saved for.

Usage

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

Defined (1)

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

/bp-xprofile/classes/class-bp-xprofile-field.php  
  1. $options = apply_filters( 'xprofile_field_options_before_save', $post_option, $this->type );