Open dcooney opened 3 years ago
Agreed that this would be an essential feature where we'd want to be able to say certain blocks can only be used by certain roles (for instance only Admins can use the Custom HTML block but Editors, Staff & Admins can use the Gallery block).
Are there any plans of implementing this feature request?
@landwire @CodingSamurai I started prototyping this however Gutenberg errors out when a block is missing.
The use case here is:
admin
users.They are still able to save the page but the experience here is a show stopper for this.
Any other ideas?
Hello @dcooney
Nice plugin! I tried to limit settings only to Editor role by adding:
if ( !current_user_can( 'editor' ) ) { return; }
At the beginning of this function:
https://github.com/dcooney/block-manager/blob/main/block-manager.php#L84
I believe it's good temporary solution. Of course, role should be retrieved from the settings page where we need select box with all roles.
My five cents! Keep doing great job!
Best Faruk
@farukgaric Missed your reply. My bad... there is a filter gutenberg_block_manager_user_role
that can switch the access role for this plugin.
add_filter( 'gutenberg_block_manager_user_role', 'edit_theme_options' );