• Hi John,
    I’ve encountered an issue with the 3.x branch where user roles are selected for fields that are also set as “Required” and the ACF Field Group is added to the WP User Form.

    I have a multi-tab field group that’s adding fields to the user profile. Some of the fields only apply to one or two user roles, and some of them are required. The user profile fields are intended to be edited via frontend form, so I used ACF User Role Field Setting to only apply to the required roles, preventing them from being displayed to the Admin user role in the WP admin.

    When I upgrade to the 3.x branch, while the fields that are configured to display only for the specific roles don’t display in the admin as intended, when I try to save a user profile I get the ACF “Validation failed” error at the top of the Profile page.

    If I downgrade to v2.1.15, I’m able to save the user profile.

    Any insight on what changed to cause this, and if it’s possible to resolve it?

    The version of ACF Pro doesn’t seem to have an effect; I’m currently running the most recent 5.9.3.

    Thanks,
    Kevin

Viewing 1 replies (of 1 total)
  • Plugin Author John Huebner

    (@hube2)

    Yes, I know exactly what changed. In older the older version the fields where removed using ACF’s ability to remove them using the acf/pepare_field filter. There was a complaint that this caused repeater data to be shuffled if a repeater sub field was removed and the order of the rows was changed. In order to solve this I changed the plugin to output hidden fields rather than remove the fields completely. The side effect is that the fields are there and acf will attempt to validate them.

    What this means is that fields marked as required will not work with this plugin now. Nor will any other field that must validate to have a non empty value.

    I don’t know of a fix. The more that time goes by and the more problems that come up the more I think that it will not be possible to resolve all the complexities of ACF and use this plugin. The best course of action is to write your own filters (acf/prepare_field) that only applies to the fields you need them to apply to and to remove the fields based on the current user role rather than use this plugin.

    It’s really not all that difficult (if you look at the code in this plugin) to check the current user role against the roles that should have access to a field.

Viewing 1 replies (of 1 total)

The topic ‘Issue with User Form + required fields’ is closed to new replies.