Skip to:
Content
Pages
Categories
Search
Top
Bottom

Checkbox field always fails and states it’s mandatory even if it is checked

  • @mvaneijgen

    Participant

    I have a custom user field which ask to the except the terms of the website, but since some time (I don’t know when, auto updates are enabled on this site) the check field is not working.

    I have checked if the field works if it is checked by default, but no luck it just always states this field is mandatory.

Viewing 5 replies - 1 through 5 (of 5 total)
  • @vapvarun

    Participant

    @mvaneijgen

    Participant

    @vapvarun thanks, wasn’t really clear what the fix entails, so for anyone else looking for a solution, it took me 10 minutes to find the link on where I could find the fix.

    You have to modify the following file /wp-content/plugins/buddypress/bp-members/screens/register.php on line 93 and change

    // $_POST[ 'field_' . $field_id ] = trim( $_POST[ 'field_' . $field_id ] );

    to

    if ( is_array( $_POST[ 'field_' . $field_id ] ) ) {
        $_POST[ 'field_' . $field_id ] = array_map( 'trim', $_POST[ 'field_' . $field_id ] );
    } else {
        $_POST[ 'field_' . $field_id ] = trim( $_POST[ 'field_' . $field_id ] );
    }

    See the page and check for the link 7845.01.patch or go to https://buddypress.trac.wordpress.org/attachment/ticket/7845/7845.01.patch

    @jessiemele

    Participant

    I had the same problem and was following the fix too, but I made a copy of that file in my child theme under my-theme-name/buddypress/bp-members/screens/register.php. I didn’t want to change it in the original plugin file, but it’s not working. Is modifying the original plugin file ok? I’m not sure why my copied version in my child theme isn’t working??

    @shanebp

    Moderator

    Child theme overloads are only for template files.

    Modifying core files is not a good idea – but in this case it is the only option.
    And the next release will include the patch – so your changes are just a temporary kludge.

    @jessiemele

    Participant

    ok gotcha, thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar