• Since a recent update (after v2.0.43), I have noticed some irregularities when using a callback function and saving multi-select fields.

    Although I can see the options in the ‘edit’ mode, they don’t always save and sometimes result in an empty field. I’ve performed plugin conflict testing, disabled caching, and the problem persists.

    Problem resolves when reverting back to v2.0.43.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Krolyn Studios

    (@krolyn)

    Further to the previous post, it appears to cause issues when you add another entry to the callback array AFTER it has been saved as a field in the form. The entry appears in the front-end ‘edit’ screen but does not save if selected.

    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hi @krolyn,

    Can you please make sure to update to the latest 2.0.48 version of the Ultimate member core and see if it helps.

    Regards.

    Thread Starter Krolyn Studios

    (@krolyn)

    @ultimatemembersupport I had. It’s when I first realised the problem.

    Thread Starter Krolyn Studios

    (@krolyn)

    @ultimatemembersupport Please advise.

    Hello @krolyn,

    Sorry, my answer will not give you the solution, I just wanted to let you know that I face the exact same problem with callback on dropdown (I ask a question about it on this subject: https://ww.wp.xz.cn/support/topic/bug-using-choices-callback-field-not-visible-in-view-mode/#post-11640656).

    All options added by the callback and that have not been “displayed” in the field edit mode in the choices list will not be saved.
    This prevent using callbacks to populate dropdown or multi-select options with new values from the database 🙁

    Thread Starter Krolyn Studios

    (@krolyn)

    According to @ultimatemembersupport, they are aware of the issue and it’s being resolved in the next release.

    Thanks for the feedback @krolyn,

    For information, If you ever need a quick way to bypass this behavior, the code that prevents a value that is not set in the field’s options list to be saved while submitting the form is in the file class-validation.php, line 75 :
    if ( in_array( $fields[ $key ]['type'], array( 'select', 'radio' ) ) && isset( $value ) && ! empty( $fields[ $key ]['options'] ) && ! in_array( $value, $fields[ $key ]['options'] ) ) { unset( $changes[ $key ] );

    I tried to comment this line and was able to save my field value.
    That should work until the next release.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Multi-select field callback irregularities when saving.’ is closed to new replies.