Home Forums Backend Issues (wp-admin) Relationship (User) field can't see Administrator users


Relationship (User) field can't see Administrator users

  • I’m using a User relationship field as a way for assigning an additional author to a post that I then use to display on my posts. Everything is working great. In the ACF field set up I use a the ‘Filter by Role’ to allow only choosing Administrator, Editor, Author, or Contributor users. The only issue is that only the Administrator role can see and choose Administrator users. All other users can see and select all other roles. Is this a bug or a security feature? If it is a security feature is there a way to work around it in this case?

  • I did some testing on this and I have been unable to recreate what you’re seeing. For example, if I set up a user field as you describe and then log in as an editor to my site I still see admin users to select.

    What other plugins are you using? Have you tried disabling them to see if you can find something else that’s causing the issue?

  • Sorry it took me longer to get back to you on this than expected. After doing extensive testing there does seem to be a plug-in conflict with WooCommerce 2.6.14. WooCommerce 3.0 came out last week, but it will be a while before I’ll be able to upgrade and test. Being a major upgrade to Woo we need to vet our theme and other plug-ins. We’re working on other stuff at the moment, so it might be a week or two before we do that.

    I have also not dug into the code to see why 2.6.14 is causing this problem with ACF either. If you have any ideas I’d appreciate your thoughts.

  • This is only a guess, but there is some filter in WC that is modifying what is returned. It is either something to do with the user query that ACF is doing or it has something to do with ACF getting the list of user roles.

    My guess is that it is getting the user roles.

    What you need to do is figure out what filter is interfering and then create a filter for the acf/fields/user/query hook that removes this filter.

    If I’m right about the user roles than something like this may work

    add_filter('acf/fields/user/query/name=field_name_here', 'remove_wc_user_role_filter', 10, 3);
    function remove_wc_user_role_filter($args, $field, $post_id) {
      remove_filter('editable_roles', 'wc_modify_editable_roles');
      return $args;

    but like I said, that’s just a guess. If that does not work I would talk to WC support and see if they can give you advice on which one of their filters is interfering with the ACF user field.

  • Thanks a lot John. I appreciate you taking the time to point me in the right direction.

  • FYI, we just upgraded to WooCommerce 3.0 and it did NOT resolve this issue. Should I report this issue to them as a “bug/conflict”?

    Update: Sorry just saw that you said in your last post that I should talk to WC.

    I can also verify that adding the filter on the wc_modify_editable_roles did not fix the issue for me so it must be some other filter. I’ve filed a bug with Woo Commerce here:

    Update 2: The above filter code DID work

  • Ok. They confirmed that there is some conflict and are looking into it, but also said that the wc_modify_editable_roles fix should work. Let me try again and I’ll update here.

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

The topic ‘Relationship (User) field can't see Administrator users’ is closed to new replies.