Support » Plugin: ACF User Role Field Setting » Version 2.1.12 Bug

  • Resolved Dave Navarro, Jr.


    I am using this plugin on a site and I have “Administrators” and “Editors” checked.

    I am an administrator and the field is not being displayed. When I log into an Editor test account the field is not being displayed. It is only displayed when “All” is checked.

    The field type is “True/False”. I am running ACF Pro 5.6.10

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


    I just did a test and I’m not seeing any issue.

    Is it working for other field types?

    Are you using the acf/user_role_setting/exclude_field_types filter to exclude any field types?

    I am not using the filter, and it does not appear to work with any fields… Hmmm.

    I have a generic site set up, let me test it there.

    Well darn, my apologies… There is a conflict with another plugin:

    Since that plugin hasn’t been updated in 2 years, I’m assuming it’s the problem, not yours. I really like that plugin. 🙁

    Plugin Author John Huebner


    I’ve never heard of the plugin, but it looks extremely useful, I was actually just working on menu changes on a site and was logging in and out to see what editors can see….

    anyway. I just did a test with with it and for me it has no effect on display of fields in this plugin when installed normally. But it can effect the global $current_user

    Basically, line 90 of that plugin removes the first user role from the user,

    $this->current_role = array_shift( $current_user->roles );

    this means that when I check the current user, the first role no longer exists and this is why it may prevent you from ever seeing the field.

    We’re both looking at the global on init with a priority of 1. What this means is that it depends on which of our plugins is loaded first. If the other plugin get’s loaded first then the role is removed and if mine loads first then it’s fine. I could alter my filter to run at a lower priority, but, the other plugin really has an issue because it should not be making modifications to the global when all it’s really doing is storing the current role in a private variable.

    Since the other plugin has not been updated in a while you can try changing line 90 to read

    $this->current_role = $current_user->roles[0];

    I just tested this and it does not seem to break the other plugin.

    That appears to do the trick, thank you so much!!

    Plugin Author John Huebner


    It’s actually given me an idea to improve this plugin by actually checking roles. I’m betting that there are other plugins and modification that also check capabilities and if I can not only get the current user roles but test to see if they currently have those capabilities it might make the display of fields more accurate in some cases. I’ll have to do some more testing and that other plugin will help me with it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Version 2.1.12 Bug’ is closed to new replies.