Archived topic
Update user capabilities for access to Appearance > Elements w Members Plugin
1 reply · Started by David on October 27, 2021
I added a new role object using the Members plugin, using it to add the 'edit_theme_options' capability for my designer.
Doing this allowed them to view Appearance > Themes, Customize, Widgets, Menus, GeneratePress options in the navigation menu of their WordPress admin dashboard. Unfortunately, adding this capability to the role object doesn't create access to "Elements" - which is my primary goal. I would like for this role to be capable of adding or updating headers, footers, etc.
Is a solution possible using Members or another plugin?
I found a similar thread where a code solution was offered:
https://generatepress.com/forums/topic/add-update-elements-for-specific-user-role/
At this point, I don't feel like I have the underlying competence to take on such a solution. Essentially I'm concerned I'll break things, so hoping for a plugin-driven solution.
Cheers!
Hi there,
If your user has the edit_theme_options capability they should have access by default.
However, that thread came to this conclusion as a way to allow editors to have access to Elements:
/* Add Access for Editor to GP Elements
------------------------------------------*/
add_filter( 'register_post_type_args', function( $args, $post_type ) {
if ( 'gp_elements' === $post_type ) {
$args['capability_type'] = 'post';
}
return $args;
}, 10, 2 );
/* Move Elements to Top Level Link to Allow Access
------------------------------------------*/
add_filter( 'register_post_type_args', function( $args, $post_type ) {
if ( 'gp_elements' === $post_type ) {
$args['show_in_menu'] = true;
}
return $args;
}, 10, 2 );
add_filter( 'generate_elements_metabox_ajax_allow_editors', '__return_true' );
Let me know if that helps or not :)