Skip to:
Content

BuddyPress.org

Changeset 12150


Ignore:
Timestamp:
05/31/2018 04:56:19 PM (16 months ago)
Author:
r-a-y
Message:

Registration: Trim POST fields for multi-select and checkbox options.

The change made in #7671 to trim registration POST fields broke profile
fields that contained multi-select or checkbox options. This is because
these fields use arrays. To address this, we now also trim array POST
fields.

See #7671.

Fixes #7845 (3.x branch).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/src/bp-members/screens/register.php

    r11927 r12150  
    9090                    bp_xprofile_maybe_format_datebox_post_data( $field_id );
    9191
     92                    // Trim post fields.
    9293                    if ( isset( $_POST[ 'field_' . $field_id ] ) ) {
    93                         $_POST[ 'field_' . $field_id ] = trim( $_POST[ 'field_' . $field_id ] );
     94                        if ( is_array( $_POST[ 'field_' . $field_id ] ) ) {
     95                            $_POST[ 'field_' . $field_id ] = array_map( 'trim', $_POST[ 'field_' . $field_id ] );
     96                        } else {
     97                            $_POST[ 'field_' . $field_id ] = trim( $_POST[ 'field_' . $field_id ] );
     98                        }
    9499                    }
    95100
Note: See TracChangeset for help on using the changeset viewer.