Home › Forums › General Issues › User role selector › Reply To: User role selector
Hi,
This post is a bit old but it mights be useful for others.
This plugin is working for me (ACF 5.8.5 / WordPress 4.x or 5.x)
It uses the same functions describe in the documentation: https://www.advancedcustomfields.com/resources/creating-a-new-field-type/
As far as i know it’s update for all versions of ACF 5.
(There is a callback file for ACF4, i don’t know if it’s working).
BUT
You could only use the ID return value, the object return doesn’t work (i don’t know why).
Basically it uses the global variable $wp_roles and the method $wp_roles->roles to get all roles.
It uses also a get_role() function to display the name in back-end.
If you want a role object using this plugin, you could retrieve it with the ID’s returned.
It’s not the best way but it’s working.
Finally it could be really usefull to integrate this field in a future version 😉
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.