Change WordPress user roles and capabilities › Forums › Bug Reports › Trouble updating "Administrator" role
- This topic has 10 replies, 2 voices, and was last updated 5 years, 6 months ago by berd0029.
-
AuthorPosts
-
25/05/2019 at 14:39 #5720berd0029Participant
I’m running wordpress multisite – latest version of 5.2.2 and URE 4.5.1
I’ve deactivated all plugins that were network activated
I can click checkboxes and unlick checkboxes for all user roles, except administrator.
On Administrator I can only check new roles, but not uncheck any roles.
There are no errors shown in the browser console, and I’ve confirmed on two different sites (although they are similar).
26/05/2019 at 13:20 #5723VladimirKeymasterURE does not allow revoke capabilities from administrator role in 2 cases:
1) for single site WordPress
2) for WordPress multisite when current user is not superadmin.This is done to prevent accidental lose of admin permissions.
26/05/2019 at 13:40 #5724berd0029ParticipantHi Vladimir – those seems like good precautions. In my situation I am attempting to update the role of administrator from the network level /wp-admin/network/users.php?page=users-user-role-editor-pro.php
and am logged in as a superadmin. I also tried from a second superadmin account to verify the problem.
Nothing shown in error or debug logs related to URE.
26/05/2019 at 13:43 #5725berd0029ParticipantI should also add that I have been using URE for several years with no problems.
I typically keep backups of old versions of plugins when I run updates, and I had version 4.47.2 saved. When I rolled back to this version, the problem was solved.26/05/2019 at 14:01 #5726VladimirKeymasterGood point. v. 4.51 does not allow to superadmin to edit ‘administrator’ role. It seems I tested JavaScript code from older version. It stopped working as expected after browser page refresh.
I will investigate what was changed and why.26/05/2019 at 14:34 #5727VladimirKeymasterQuick workaround:
open user-role-editor-pro/js/ure.js, go to line 552 and replace current:if ( ure_data.do_not_revoke_from_admin ) {
with updated
if ( ure_data.do_not_revoke_from_admin==1 ) {
26/05/2019 at 14:34 #5728VladimirKeymasterOr course I will include this fix into the next update.
26/05/2019 at 14:35 #5729berd0029ParticipantI just tested logged in as Super Admin testing from root site, and in version 4.51 I still have the same problems as I do at network level. I Can add capabilities to Admin role, but not remove them.
26/05/2019 at 14:46 #5730berd0029ParticipantI tried the change you recommended, but it unfortunately did not solve the problem for me on the root site or at network level.
jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes if (this.id.length===0) { return; } jQuery(this).prop('checked', response.caps.hasOwnProperty(this.id) && response.caps[this.id]); if ( ure_data.do_not_revoke_from_admin==1 ) { var el = document.getElementById(this.id); if ( 'administrator'===ure_current_role ) { el.addEventListener( 'click', ure_turn_it_back ); } else { el.removeEventListener( 'click', ure_turn_it_back ); } } });
26/05/2019 at 15:03 #5731VladimirKeymasterJust be sure (re-check) that updated code was loaded at the testing page (force page refresh).
26/05/2019 at 15:43 #5732berd0029ParticipantApologies but I had not done that. A shift +f5 to clear the browser cache solved the problem once the code was updated.
Thanks for your quick response in solving this!
best wishes,
-Dan
-
AuthorPosts
- You must be logged in to reply to this topic.