Change WordPress user roles and capabilities › Forums › Bug Reports › New Role will not retain the ‘manage options’ setting
- This topic has 6 replies, 2 voices, and was last updated 3 years, 8 months ago by Vladimir.
-
AuthorPosts
-
11/01/2021 at 23:19 #7261mereagencyParticipant
Every time I set this ‘manage options’ capability for my ‘Site Manager’ roles, it revokes as soon as I refresh the page. What’s strange is when I log in as the site manager in a different browser, the permissions are there for one page load, and then they reset.
Site: studio.mere.site (theme demo)
13/01/2021 at 00:56 #7264VladimirKeymasterIs ‘Site Manager’ role created by some plugin? I suppose the situation when that plugin recreates this role every time its loaded.
What if you add ‘manage_options’ to any other role? Will it stay there?
If Yes, use workaround – assign role with ‘manage_options’ to the user with ‘Site Manager’ role as the 2nd one.20/01/2021 at 16:59 #7286mereagencyParticipantHi Vladimir,
Site Manager is a role I created in User Role Editor. But the plugin SEOPress seems to be revoking manage_options every time it is activated.21/01/2021 at 14:55 #7289VladimirKeymasterHi,
I can not repeat this.
I tested SEOPress from wordpress.org and it did not remove ‘manage_options’ from my custom roles. I searched from its source code and did not find any commands related to ‘manage_options’ deletion.01/04/2021 at 19:45 #7469mereagencyParticipantHi Vladimir,
I’m still having this problem. Is it possible to grant you access to one of the sites and show you what’s happening? When I add ‘manage options’, I see the user’s menus, etc change, but as soon as I load the page a second time, the option is remove.d01/04/2021 at 20:04 #7470mereagencyParticipantThis seems to happen with Simple Banner, I’ve filed a bug report with them specifically.
02/04/2021 at 01:32 #7471VladimirKeymasterHi,
I confirm this. Simple banner plugin does not think that role may edited manually, and applies the logic: if role has ‘manage_simple_banner’ capability, thus it was granted automatically by SB plugin itself, then if role is not included into the list of roles allowed to work with SB (Pro feature), then automatically revoke ‘manage_simple_banner’ and ‘manage_options’ user capability from such role:
// Add permissions for other roles foreach (get_editable_roles() as $role_name => $role_info) { if ( $role_name !== 'administrator') { if (in_array($role_name, explode(",", $permissions_array))) { $add_role = get_role( $role_name ); $add_role->add_cap( $manage_simple_banner ); $add_role->add_cap( $manage_options ); } else { $remove_role = get_role( $role_name ); // only remove capabilities if they were previously added if ($remove_role->has_cap( $manage_simple_banner )){ $remove_role->remove_cap( $manage_simple_banner ); $remove_role->remove_cap( $manage_options ); } } } }
-
AuthorPosts
- You must be logged in to reply to this topic.