Skip to:
Content

BuddyPress.org

Ticket #5742: 5742.patch

File 5742.patch, 2.9 KB (added by needle, 12 years ago)
  • bp-xprofile/bp-xprofile-classes.php

     
    10971097
    10981098                $this->user_id      = apply_filters( 'xprofile_data_user_id_before_save',      $this->user_id,         $this->id );
    10991099                $this->field_id     = apply_filters( 'xprofile_data_field_id_before_save',     $this->field_id,        $this->id );
    1100                 $this->value        = apply_filters( 'xprofile_data_value_before_save',        $this->value,           $this->id );
     1100                $this->value        = apply_filters( 'xprofile_data_value_before_save',        $this->value,           $this->field_id );
    11011101                $this->last_updated = apply_filters( 'xprofile_data_last_updated_before_save', bp_core_current_time(), $this->id );
    11021102
    11031103                do_action_ref_array( 'xprofile_data_before_save', array( $this ) );
  • bp-xprofile/bp-xprofile-filters.php

     
    6262 * Run profile field values through kses with filterable allowed tags.
    6363 *
    6464 * @param string $content
     65 * @param int $field_id
    6566 * @return string $content
    6667 */
    67 function xprofile_filter_kses( $content ) {
     68function xprofile_filter_kses( $content, $field_id = null ) {
    6869        global $allowedtags;
    6970
    7071        $xprofile_allowedtags             = $allowedtags;
    7172        $xprofile_allowedtags['a']['rel'] = array();
    7273
    73         $xprofile_allowedtags = apply_filters( 'xprofile_allowed_tags', $xprofile_allowedtags );
     74        $xprofile_allowedtags = apply_filters( 'xprofile_allowed_tags', $xprofile_allowedtags, $field_id );
    7475        return wp_kses( $content, $xprofile_allowedtags );
    7576}
    7677
     
    9495
    9596        // Filter single value
    9697        if ( !is_array( $field_value ) ) {
    97                 $kses_field_value     = xprofile_filter_kses( $field_value );
     98                $kses_field_value     = xprofile_filter_kses( $field_value, $field_id );
    9899                $filtered_field_value = wp_rel_nofollow( force_balance_tags( $kses_field_value ) );
    99                 $filtered_field_value = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value );
     100                $filtered_field_value = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_field_value, $field_value, $field_id );
    100101
    101102        // Filter each array item independently
    102103        } else {
    103104                $filtered_values = array();
    104105                foreach ( (array) $field_value as $value ) {
    105                         $kses_field_value       = xprofile_filter_kses( $value );
     106                        $kses_field_value       = xprofile_filter_kses( $value, $field_id );
    106107                        $filtered_value         = wp_rel_nofollow( force_balance_tags( $kses_field_value ) );
    107                         $filtered_values[] = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_value, $value );
     108                        $filtered_values[] = apply_filters( 'xprofile_filtered_data_value_before_save', $filtered_value, $value, $field_id );
    108109
    109110                }
    110111