xprofile_data_value_before_save

  • apply_filters( 'xprofile_data_value_before_save',        $this->value,           $this->id )

    Source Reference:

    • Component: BuddyPress :: bp-xprofile
      File: /bp-xprofile/bp-xprofile-classes.php :: Trac Source Line: 871
      		return apply_filters_ref_array( 'xprofile_data_is_valid_field', array( (bool)$retval, &$this ) );
      	}
      
      	function save() {
      		global $wpdb, $bp;
      
      		$this->user_id      = apply_filters( 'xprofile_data_user_id_before_save',      $this->user_id,         $this->id );
      		$this->field_id     = apply_filters( 'xprofile_data_field_id_before_save',     $this->field_id,        $this->id );
      		$this->value        = apply_filters( 'xprofile_data_value_before_save',        $this->value,           $this->id );
      		$this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this->id );
      
      		do_action_ref_array( 'xprofile_data_before_save', array( &$this ) );
      
      		if ( $this->is_valid_field() ) {
      			if ( $this->exists() && !empty( $this->value ) && strlen( trim( $this->value ) ) ) {
      				$result   = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->profile->table_name_data} SET value = %s, last_updated = %s WHERE user_id = %d AND field_id = %d", $this->value, $this->last_updated, $this->user_id, $this->field_id ) );
      
      			} else if ( $this->exists() && empty( $this->value ) ) {
      				// Data removed, delete the entry.
      

Hook: add_filter: xprofile_data_value_before_save instances (1)

  • add_filter( 'xprofile_data_value_before_save',        'xprofile_sanitize_data_value_before_save', 1, 2 )
    $tag: xprofile_data_value_before_save
    $function_to_add: xprofile_sanitize_data_value_before_save
    $priority: 1
    $accepted_args: 2

    Source Reference:

    • Component: BuddyPress :: bp-xprofile
      File: /bp-xprofile/bp-xprofile-filters.php :: Trac Source Line: 47
      add_filter( 'xprofile_get_field_data',                'stripslashes' );
      
      /* Custom BuddyPress filters */
      
      add_filter( 'bp_get_the_profile_field_value',         'xprofile_filter_format_field_value', 1, 2 );
      add_filter( 'bp_get_the_site_member_profile_data',    'xprofile_filter_format_field_value', 1, 2 );
      add_filter( 'bp_get_the_profile_field_value',         'xprofile_filter_link_profile_data', 9, 2 );
      
      add_filter( 'xprofile_data_value_before_save',        'xprofile_sanitize_data_value_before_save', 1, 2 );
      add_filter( 'xprofile_filtered_data_value_before_save', 'trim', 2 );
      
      /**
       * xprofile_filter_kses ( $content )
       *
       * Run profile field values through kses with filterable allowed tags.
       *
       * @param string $content
       * @return string $content
       */
      

Comments are closed.