Skip to:
Content
Pages
Categories
Search
Top
Bottom

User registration fails when multiple options selected in BuddyPress 3.0.0


  • rhwentworth
    Participant

    @rhwentworth

    In BuddyPress 3.0.0, there is a bug insofar as if a registration form is submitted and a multi-select or checkbox is involved, and multiple options are present, the registration fails with a run-time error as follows:

    Warning: trim() expects parameter 1 to be string, array given in /home8/fromchao/public_html/buddypress/wp-content/plugins/buddypress/bp-members/screens/register.php on line 93

    In my local copy, I patched line 92 to add a check to see if an what was returned is an array, and this eliminated the error for me. Might even be the right fix, as the individual returns in an array shouldn’t need trimming.

    if ( isset( $_POST[ ‘field_’ . $field_id ] ) and !is_array( $_POST[ ‘field_’ . $field_id ] ) ) { // FIXED!!
    $_POST[ ‘field_’ . $field_id ] = trim( $_POST[ ‘field_’ . $field_id ] );
    }

    This problem occurred on a dev test site running WordPress 4.9.6. But, the problem and its cause seem pretty obvious, and not a function of WordPress itself. Just needs to be fixed in the official distribution.

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘User registration fails when multiple options selected in BuddyPress 3.0.0’ is closed to new replies.
Skip to toolbar