Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › How to keep subsite user permissions
- This topic has 4 replies, 2 voices, and was last updated 4 years, 1 month ago by Vladimir.
-
AuthorPosts
-
04/10/2020 at 14:07 #7059thebigbanikParticipant
Hi, In my network I have 3 user roles BASIC MANAGER(BM), ADVANCED MANAGER(AM) and ULTIMATE MANAGER(UM). I created a default subsite BASE SITE that has the 3 Custom Post Types BLOG, PROGRAMMS and STAFF. This subsite will be cloned to keep every CPT and settings so I don’t have to create them from the begining. Now, (BM) has permissions for BLOG, (AM) has permissions for BLOG and PROGRAMMS and (UM) has permissions to all three CPTs. Those permissions have been set in the default subsite BASE SITE so every time I clone it, permissions will be transfered. So far so good. BUT, if I need to change some other permissions (e.g. edit_other_posts) for those 3 user roles from the Network admin User Role Editor, when selecting Update Network those 3 user roles loses their CPTs capabilities that have been inherited before and I have to reassign them manually for every user role and in every subsite, I will have over 500 subsites. It is crazy. Why is this overriding the CPTs capabilities? Should I create the same CPTs on the main site too so there will be a network association with those CPTs? Thanks, lloking forward for youor reply.
04/10/2020 at 14:42 #7060thebigbanikParticipantReplying to my post, I created the same CPTs in the main site with the same Capability Type as in the subsite and it worked. I just need you to verify that this is the right way. Thanks.
04/10/2020 at 14:51 #7061VladimirKeymasterYes, I confirm the result of your experiment.
How to sync user roles between all the sites of a mulitisite WordPress
04/10/2020 at 15:35 #7062thebigbanikParticipantThanks, I have already done all these. My problem is with the CPTs. If I Update Network, user roles loses their capabilities of the CPTS in each subsite because as you said it overrides the settings. I did create the exact same CPTs in the main site and now they appeared in the menu but posts are missing and I cannot create a new one. So, I deleted the CPTs from the main site and left it only in the subsite. But now, even if I have granted access to the capabilities of these CPTS, the user role has no acces, I get the message “Sorry, you cannot edit”. But I have checked the edit_prosforas, edit_others_prosforas, read_prosforas etc, everything that is related to this CPT. Did I mess up everything? It is a very complicating thing Roles and Capabilities.
05/10/2020 at 04:27 #7065VladimirKeymasterRoles & Capabilities list and user permissions are fully independent between subsites. So problem with access is related to the main site only in the part of the replication roles from the main site. You should get exact copy of permissions you grant to a roles at the main site after replication.
Try to grant ‘edit_posts’ in addition. Just in case it will help.
If you turned ‘ON’ the “Activate “Create” capability for posts/pages/custom post types” option at URE’s Settings then you have to grant ‘create_prosforas’ to a role in order it can add new ‘prosfora’.
Another assumption,
do you have ‘Activate user access management to editing selected posts, pages, custom post types’ option turned ON at URE’s Settings? If Yes, there a conflict is possible, in case, if ‘posfora’ CPT is defined with own custom user capabilities and developer check some of those capabilities directly in the code, e.g. current_user_can(‘cst_edit_prosforas’).
In this case URE can not help with redefining CPT capabilities. It works correctly only in case code takes capability to check directly from CPT definition, like
$cpt->caps['edit_posts']
(just for example) not ‘cst_edit_prosforas’. -
AuthorPosts
- You must be logged in to reply to this topic.