Admin unable to change role in user profile if ‘Can user edit field’ not set
-
I believe I have found a bug that has been introduced during an update at some stage (it used to work)
I hope the description below is clear and sufficient.
I would appreciate if you can tell me if this is reproducible, fixable and if there is any workaround in the meantime.
UM version 2.1.20 and 2.2.0 and 2.2.2
Wordpress version 5.8
Theme = Divi version 4.9.101. I use a profile form that uses the pre-defined field ‘Role (dropdown)’
2. The field ‘Can user edit this field?’ is NOT checked as I don’t want users to edit their own roles
3. The role field is visible and not editable when the user is editing their own profile (as you would expect)
4. Editing the users profile page as Admin, the role field is editable. (as you would expect)
5. When changing the users role and saving the profile, the role reverts to its original value. (not helpful)There are no relevant errors in the debug.log file.
When investigating, I have tried the following:
1. Check the ‘Can user edit this field?’ checkbox:
The result is that both user and admin can change the role. (but this is not the behaviour that I want)2. In code, Add the UM action ‘um_user_pre_updating_profile’
The array passed to the function contains a [role] element when ‘Can user edit this field?’ is checked but [role] element is missing when not checked.3. In code, add the WordPress Action ‘set_user_role’.
This action is called when ‘Can user edit this field?’ is checked but is not called when not checked.Thanks in advance,
– Jerry
- The topic ‘Admin unable to change role in user profile if ‘Can user edit field’ not set’ is closed to new replies.