Restrict publish environment (preview or live) by user role
As a standard feature, Strattic allows you to control which WordPress user roles have the ability to publish to your static preview and live environments by going to Strattic > Settings > General (learn more about general settings)
Restrict publishes by publish type (full, quick or selective) and environment (preview or live) by user role
If you wish to take that a step further, it is possible to also limit publishing types (full publish, quick publish and selective publish) for user groups as well.
As an example;
You may want your authors to only have the ability to publish to your preview environment and not to your live environment.
Step 1.
Install and activate the free User Role Editor plugin
Step 2.
Now, in the WordPress Admin menu, go to Users > User Role Editor
Select a role that you’ve created a user for (e.g. Author)
Step 3.
Select a role that you’ve created a user for (e.g. Author)
Step 4.
Use the Quick filter search box to type “strattic”.
Step 5.
You should see the following capabilities:
-
strattic_can_publish_to_live_full
User role can initiate a full publish to the live environment
-
strattic_can_publish_to_live_quick
User role can initiate a quick publish to the live environment
-
strattic_can_publish_to_live_selective
User role can initiate a selective publish to the live environment
-
strattic_can_publish_to_preview_full
User role can initiate a full publish to the preview environment
-
strattic_can_publish_to_preview_quick
User role can initiate a quick publish to the preview environment
-
strattic_can_publish_to_preview_selective
User role can initiate a selective publish to the preview environment
Check the box next to the ability you wish to enable for that user role.
Step 6.
Once you have made all your changes, press the blue update button to save.
Restrict publishing to individual users
You may want to go a step even further and only allow certain users on your site to be able to publish.
-
Install and active the Members plugin.
-
In your WordPress admin, go to Members > Roles
-
Clone an existing role, typically “Administrator” and name it “Admin with Strattic Publish” (or similar)
-
Confirm that the new role all the Strattic publish options:
-
Edit the default “Admin” role and remove all the Strattic publish options by unchecking the checkmarks in the “Grant” column:
-
Assign the relevant users to the new “Admin with Strattic Publish” role.
Multiple User Roles
It is important to note that if your WordPress user account has multiple roles assigned to it, then all roles need to have the correct publishing permissions in order to be able to publish.
Alternatively, you can unassign the user role that doesn’t have publishing permission keeping the role that does.