Skip to:
Content

BuddyPress.org

Changeset 10239


Ignore:
Timestamp:
10/10/2015 07:39:37 PM (10 years ago)
Author:
djpaul
Message:

xprofile admin: fix handling of slashes in xprofile group name/desc

Add filters to parts of the xprofile wp-admin templates so we're
running group description and name through the same output filters that
are used in the front-end template parts (for stripslashes).

Also adds a stripslashes to profile group name and description
before_save filters to fix the root issue. By keeping the existing
on-display stripslashes, we maintain backwards compatibility.

Fixes #6081

Props mahype, djpaul

Location:
trunk/src/bp-xprofile
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/bp-xprofile-admin.php

    r10232 r10239  
    115115                        <li id="group_<?php echo esc_attr( $group->id ); ?>">
    116116                            <a href="#tabs-<?php echo esc_attr( $group->id ); ?>" class="ui-tab">
    117                                 <?php echo esc_attr( $group->name ); ?>
     117                                <?php
     118                                /** This filter is documented in bp-xprofile/bp-xprofile-template.php */
     119                                echo esc_html( apply_filters( 'bp_get_the_profile_group_name', $group->name ) );
     120                                ?>
    118121
    119122                                <?php if ( !$group->can_delete ) : ?>
     
    131134
    132135                    <noscript>
    133                         <h3><?php echo esc_attr( $group->name ); ?></h3>
     136                        <h3><?php
     137                        /** This filter is documented in bp-xprofile/bp-xprofile-template.php */
     138                        echo esc_html( apply_filters( 'bp_get_the_profile_group_name', $group->name ) );
     139                        ?></h3>
    134140                    </noscript>
    135141
     
    165171                        <?php if ( ! empty( $group->description ) ) : ?>
    166172
    167                             <p><?php echo esc_html( $group->description ); ?></p>
     173                            <p><?php
     174                            /** This filter is documented in bp-xprofile/bp-xprofile-template.php */
     175                            echo esc_html( apply_filters( 'bp_get_the_profile_group_description', $group->description ) );
     176                            ?></p>
    168177
    169178                        <?php endif; ?>
    170179
    171180                        <fieldset id="<?php echo esc_attr( $group->id ); ?>" class="connectedSortable field-group">
    172                             <legend class="screen-reader-text"><?php printf( esc_html__( 'Fields for "%s" Group', 'buddypress' ), $group->name ); ?></legend>
     181                            <legend class="screen-reader-text"><?php
     182                            /** This filter is documented in bp-xprofile/bp-xprofile-template.php */
     183                            printf( esc_html__( 'Fields for "%s" Group', 'buddypress' ), apply_filters( 'bp_get_the_profile_group_name', $group->name ) );
     184                            ?></legend>
    173185
    174186                            <?php
  • trunk/src/bp-xprofile/bp-xprofile-filters.php

    r10203 r10239  
    5959add_filter( 'xprofile_group_description_before_save', 'wp_filter_kses' );
    6060
     61add_filter( 'xprofile_group_name_before_save',         'stripslashes' );
     62add_filter( 'xprofile_group_description_before_save',  'stripslashes' );
     63
    6164// Save fields.
    6265add_filter( 'xprofile_field_name_before_save',         'wp_filter_kses' );
     
    6467add_filter( 'xprofile_field_description_before_save',  'wp_filter_kses' );
    6568add_filter( 'xprofile_field_order_by_before_save',     'wp_filter_kses' );
     69
    6670add_filter( 'xprofile_field_is_required_before_save',  'absint' );
    6771add_filter( 'xprofile_field_field_order_before_save',  'absint' );
Note: See TracChangeset for help on using the changeset viewer.