Skip to:
Content

BuddyPress.org

Changeset 12151


Ignore:
Timestamp:
05/31/2018 04:56:41 PM (7 years 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.

Fixes #7845 (trunk).

File:
1 edited

Legend:

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

    r11927 r12151  
    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.