MainWP Community

Branding - apply remove & disable to user roles/specific users

is there a way to specify for which user roles remove and disable options can be applied. i have it locked down but when i log in as an admin i keep trying to hit the plugin if i need to make an edit. that doesn’t work and i have to modify the plugin locally then delete and update the new version through mainWP which is somewhat of a pain. other alternative is to keep turning the settings on/of when i want to work on a site for a little while.

Hi @support27, can you see here and let me know if that is what you are looking for?

awesome… is there a snippet for user roles? that’s what I’d be mostly interested… so it applies to all user roles BUT admin

Or let’s say different user roles. admin, editor, etc

Can you try with this:

add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' ); 
function mycustom_mainwp_child_branding_init_options( $option ) {        
      if ( current_user_can( 'manage_options' ) && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) {        
          $option[ 'cancelled_branding' ] = true;    
     }       
     return $option; 
}

so how would i define particular user roles? this seems to be tied to actual permissions rather than user roles

This specific snippet with current_user_can( 'manage_options' ) targets administrator role. Only an Administrator can manage options. With this snippet only administrator users won’t see custom bradning.

Maybe it’s easier to use current_user_can( 'administrator' ) or current_user_can( 'editor' ) or current_user_can( 'author' )

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.