Integration with the Advanced Custom Fields (ACF) plugin was the most-requested integration, so it made sense to tackle it next. It turned out to be an interesting project because I haven’t used ACF outside of installing it for the purposes of doing code audits for third-party theme and plugin developers. I learned a lot about how the plugin works and got a better understanding of why developers who use ACF need such an integration.
With that in mind, let me introduce you to the Members – ACF Integration add-on plugin.
Once I dug into ACF, I could see why it was requested. ACF doesn’t come with its own set of capabilities out of the box, and users of the plugin want to have more control over who has permission to do what. That’s where this integration add-on comes in.
The add-on plugin creates a set of new capabilities available via the Members role editor (Users > Roles > Edit Role in the admin). The following caps are now available:
manage_acf– Grants access for managing the ACF plugin (akin to the
manage_optionscapability, which should only be given to highly-trusted users).
edit_acf_field_groups– Allows users to create and edit field groups.
edit_others_acf_field_groups– Allows users to edit other user’s field groups.
delete_acf_field_groups– Allows users to delete field groups.
delete_others_acf_field_groups– Allows users to delete other user’s field groups.
This is a limited set of capabilities in comparison to other post types (see Notes section below), but it should provide enough flexibility for users who need more control.
The add-on creates a new role group under the Users > Roles screen called “Advanced Custom Fields.” This role group lists all roles that have an ACF-related capability, which allows you to see at a glance which user roles have permission to interact with ACF in some way.
Members 3.0 sneak peek
I’m thinking of making this a tradition with Members plugin blog posts, at least until I launch version 3.0. The above is a screenshot of what this integration will likely look like in the 3.0 role editor UI. I’m hard at work at making sure I get 3.0 launched this year.
Because of how ACF handles some of its capability checks (it’s much different than more traditional plugins with custom post types), it wasn’t possible for me to offer a wider array of capabilities. With any luck, this will be possible in the future.
Also, it’s possible that this add-on may not work with plugins that do one of the following things:
- Change ACF’s default admin menu items in some way (adding extra sub-menus is perfectly OK).
- Alters how ACF saves field groups.
- Uses ACF’s capability check outside of the
save_posthook when saving field group data.
I had to add a couple of workarounds to work within the confines of what’s allowed by the ACF plugin. For the vast majority of use cases, these items should be a non-issue. However, I wanted to make sure this was noted up front.
I’ve opened a GitHub ticket to address some of this. And, if these changes make their way into ACF, I’ll update this integration to take advantage of the added flexibility they’d offer.
Get Members – ACF Integration
If you’re already a Members Pro or All-Access (premium) member, you can grab a copy of the plugin from your account page.
If you’re not currently a member, drop by the plugin page and purchase membership. It includes access to all Members add-ons and support for one year.