Allow Different WordPress User Roles to Use Different Gutenberg Blocks

Profiles

It is possible to control access to certain Gutenberg blocks for some users or WordPress roles.

This is possible thanks to the PublishPress Blocks plugin and its Block Access system

Keep reading to learn how to use this useful PublishPress Blocks feature.


Step #1. Install the PublishPress Blocks plugin

  • Click Plugins > Add New.
  • Type PublishPress Blocks in the search box.
  • Click Install Now.
  • Click Activate.

Step #2.Check the Default profile

PublishPress Blocks comes with a default profile. This profile is assigned to all users across the site unless stated otherwise. The Default profile is allowed to insert any and all blocks when editing a post. 

  • Click PublishPress Blocks > Profiles.
  • Click Default.
200921 Advg Profile System 001
200921 Advg Profile System 001

You will be presented with a list of all blocks (Blocks list tab on the top left corner) which you can use within the WordPress Block Editor. These blocks are grouped into categories as follows: 

  • Text
  • Media
  • Design
  • Widgets
  • Embeds
  • Reusable blocks
  • PublishPress Blocks

Notice the possibility to enable/disable block features related to all blocks within the editor and not only to the ones managed by the PublishPress Blocks plugin. 

Furthermore, there is the possibility to add new profiles and assign them either to single users or to entire WordPress roles. This can be done with the orange button labeled “New profile” (we are going to do this in a later step of this tutorial).

200921 Advg Profile System 002
200921 Advg Profile System 002
  • Click the Profile Attribution tab.

You can activate/deactivate the profile you have created for a whole user group or for single users. I am working with a fresh installation of WordPress, so there is not much action here. Let’s create some users and get back here to check the possibilities.

200921 Advg Profile System 003
200921 Advg Profile System 003

Step #3. Create Users

In this step, we're going to create some users for our new profiles.

  • Click Users > Add New.
  • Create 4 users according to the table below:
NameGroupBlock accessBlock restriction
admin (default user)AdministratorAll blocks
JimEditorAlmost all blocksWidgets
MaryAuthorText, Media, Design, PublishPress BlocksAll other blocks
PeterAuthorText, Media (no files/no audio), PublishPress BlocksAll other blocks
EthelContributorText, PublishPress BlocksAll other blocks

Notice that two of the new users, Mary and Peter, share the same group. However, Peter is not allowed to use Design blocks in his posts, while Mary is. Peter is also not allowed to upload text or audio to his posts. These permissions will be configured in Step #4.

200921 Advg Profile System 004
200921 Advg Profile System 004

Step #4. Create Profiles for the new users

We need to create and configure 4 profiles to match each use case:

Here are next thing we need to do for these profiles:

  • Click PublishPress Blocks > Profiles > New profile
200921 Advg Profile System 005
200921 Advg Profile System 005
  • Create the Editor profile first.
  • Write a proper title.
  • Active the profile only for the corresponding group.
  • Click Save.
  • Repeat the process with the other WP groups.
200921 Advg Profile System 006
200921 Advg Profile System 006
  • Create a profile called Restricted author. 
  • Assign this profile to the author with the extra restriction.
  • Turn off all group toggles.
200921 Advg Profile System 007
200921 Advg Profile System 007
  • Click Save.
  • Click Back to profiles list on the left column.

You will see the profiles you created. Now it is time to restrict the access to the specified blocks. 

  • Click the editor link.
  • Click the Blocks list tab.
  • Toggle off all blocks inside the Widgets section.
  • Scroll down and click Save.
200921 Advg Profile System 008
200921 Advg Profile System 008

Repeat this process with the Contributor, Author, and Restricted author profiles, according to the table on step #3. Notice for example, that you have to disable two blocks inside the Media section when configuring the restricted author profile.

200921 Advg Profile System 009
200921 Advg Profile System 009

Follow the same logic to configure the other profiles. 

  • Click Save each time you make a change.

To recap:

  • We have created several profiles.
  • We have assigned these newly created profiles to a certain WP group, groups, and/or user/users.
  • We have set the access permission to each block in the block editor for the different profiles, on a per-block basis.

You might find this process somehow cumbersome, however, that is just the first setup. After that, you can modify access permissions of already created profiles in a very quick way with a couple clicks.


Step #5. Test the permissions

For our final step, let's test the user accounts we have set up.

  • Log out and log back in as the Contributor user
200921 Advg Profile System 010
200921 Advg Profile System 010
  • Click Posts > Add New.
  • Type the / symbol to search for the video block.

The only option available will be the PublishPress Blocks video block. This is also a good form of achieving a consistent style across contributors since they only have one option, so all videos across all Contributor posts will look the same, regarding their styling.

You can check with the other users we created on step #3 and discover all other possibilities offered by the profile system. 

I hope you liked this tutorial and enjoy using Gutenberg. If you really don't enjoy Gutenberg, there are multiple ways you can disable the block editor. Thanks for reading and I hope the PublishPress Blocks plugin is useful for you.


Leave a Reply

Your email address will not be published. Required fields are marked *

Professional publishing plugins for WordPress! Get PublishPress

  • SUBSCRIBE TO OUR NEWSLETTER
  • SEARCH THIS SITE