Skip to:
Content

BuddyPress.org

Ticket #8623: 8623.2.patch

File 8623.2.patch, 1.5 KB (added by imath, 4 years ago)
  • src/bp-xprofile/classes/class-bp-xprofile-field.php

    diff --git src/bp-xprofile/classes/class-bp-xprofile-field.php src/bp-xprofile/classes/class-bp-xprofile-field.php
    index 20eb7224b..c42b11fb5 100644
    class BP_XProfile_Field { 
    570570        public function get_children( $for_editing = false ) {
    571571                global $wpdb;
    572572
    573                 // Sanitize 'order_by'.
    574                 $order_by = bp_esc_sql_order( $this->order_by );
    575 
    576573                // This is done here so we don't have problems with sql injection.
    577                 if ( empty( $for_editing ) ) {
    578                         $sort_sql = "ORDER BY name {$order_by}";
     574                if ( empty( $for_editing ) && in_array( $this->order_by, array( 'asc', 'desc' ), true ) ) {
     575                        $sort_sql = sprintf( 'ORDER BY name %s', bp_esc_sql_order( $this->order_by ) );
    579576                } else {
    580577                        $sort_sql = 'ORDER BY option_order ASC';
    581578                }
    class BP_XProfile_Field { 
    598595                 * @since 1.2.5
    599596                 * @since 3.0.0 Added the `$this` parameter.
    600597                 *
    601                  * @param array             $children    Found children for a field.
    602                  * @param bool              $for_editing Whether or not the field is for editing.
    603                  * @param BP_XProfile_Field $this        Field object
     598                 * @param array             $children     Found children for a field.
     599                 * @param bool              $for_editing  Whether or not the field is for editing.
     600                 * @param BP_XProfile_Field $field_object BP_XProfile_Field Field object.
    604601                 */
    605602                return apply_filters( 'bp_xprofile_field_get_children', $children, $for_editing, $this );
    606603        }