• Ultimate member ignores the “required” attribute, when creating a field with conditional logic.

    The field does show up, but I can send the registration even when it is not filled.

    Any ideas on how to fix that?

    • This topic was modified 6 years, 9 months ago by mindflipmedia.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello

    Which UM version you are using ?

    Thread Starter mindflipmedia

    (@mindflipmedia)

    The current one: 1.3.88

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @mindflipmedia,

    This issue may be caused by your theme/plugin conflicts. Please try to do a conflict test so we can rule out any conflicts and see if this issue goes away.
    How to do a plugin/theme conflict test?
    You can also try to update to our latest 2.0.1 core version and see if it helps.
    Here is the doc on how to update to the latest 2.0.1 beta.

    Regards.

    Hi @ultimatemembersupport,

    i’m having the same issue as @mindflipmedia. Already tried deactivating any other plugins and switching to a standard theme, nothing changes, the issue still occurs.

    Any tips on that?
    thanks!

    Andrea

    @ultimatemembersupport

    confirmed, happening to me too.

    Ultimate Member v1.3.88 on vanilla WordPress v4.9.4 without any other plugin.
    Conditional fields can be submitted empty even if they are required.

    EDIT: it happens the second time you submit the form.

    The first time $array['required'] (in core/um-actions-form.php) is correctly set to 1.

    The second time you submit the fields, $array['required'] is 0

    checking what’s going on in um_get_custom_field_array($array, $fields) in core/um-filters-fields.php

    • This reply was modified 6 years, 8 months ago by tizeta. Reason: added details

    Ok I guess I found the bug:

    in core/um-filters-fields.php

    if( isset( $_POST[ $metakey ] ) && isset( $array['conditional_value'] ) && $_POST[ $metakey ] !== $array['conditional_value'] )

    must become:

    if( isset( $_POST[ $metakey ] ) && isset( $array['conditional_value'] ) && $_POST[ $metakey ][0] !== $array['conditional_value'] )

    and

    if( isset( $_POST[ $metakey ] ) && isset( $array['conditional_value'.$a] ) && $_POST[ $metakey ] !== $array['conditional_value'.$a] )

    must become:

    if( isset( $_POST[ $metakey ] ) && isset( $array['conditional_value'.$a] ) && $_POST[ $metakey ][0] !== $array['conditional_value'.$a] )

    basically $_POST[ $metakey ] is an array so it was missing the index [0]

    I hope this is correct, it works for me

    Hi,
    Where can I find that code in order to correct it?
    Thank you

    @scardo2000

    As I wrote, it’s in the plugin’s folder, in core/um-filters-fields.php.

    Lines 310 and 313, anyway you can search for it with your text editor.

    Bye!

    Now the code looks different and i don’t know how to fix the bug.

    Could somebody help me?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Required fields not working with conditional logic’ is closed to new replies.