Change Avada admin menu permissions

Avada theme from ThemeFusion is one of the popular WordPress themes. So I get from time to time the similar questions from the User Role Editor users:
– How to allow access to “Avada” menu at WordPress admin back-end to the users without ‘Administrator’ role?

Avada protects its menu by the ‘administrator’ role. The ‘administrator’ role ID is hardcoded in Avada’s includes/class-avada-admin.php file:

 
$welcome_screen = $avada_menu_page_creation_method( 'Avada', 'Avada', 'administrator', 'avada', array( $this, 'welcome_screen' ), 'dashicons-fusiona-logo', '2.111111' );

$support       = $avada_submenu_page_creation_method( 'avada', esc_attr__( 'Avada Support', 'Avada' ), esc_attr__( 'Support', 'Avada' ), 'administrator', 'avada-support', array( $this, 'support_tab' ) );
$demos         = $avada_submenu_page_creation_method( 'avada', esc_attr__( 'Install Avada Demos', 'Avada' ), esc_attr__( 'Install Demos', 'Avada' ), 'administrator', 'avada-demos', array( $this, 'demos_tab' ) );
$plugins       = $avada_submenu_page_creation_method( 'avada', esc_attr__( 'Plugins', 'Avada' ), esc_attr__( 'Plugins', 'Avada' ), 'administrator', 'avada-plugins', array( $this, 'plugins_tab' ) );
$status        = $avada_submenu_page_creation_method( 'avada', esc_attr__( 'System Status', 'Avada' ), esc_attr__( 'System Status', 'Avada' ), 'administrator', 'avada-system-status', array( $this, 'system_status_tab' ) );
$theme_options = $avada_submenu_page_creation_method( 'avada', esc_attr__( 'Theme Options', 'Avada' ), esc_attr__( 'Theme Options', 'Avada' ), 'administrator', 'themes.php?page=avada_options' );

The only way to resolve this task was to directly edit Avada’s source code and replace ‘administrator’ with another user capability, like ‘manage_options’. It’s not a good decision as this modification will be lost with every Avada’s version update.

I offer another decision. If you install code below as a Must Use plugin or insert it into your Avada child theme’s functions.php file (preferable), it will replace default Avada menu with it’s own copy, which uses different user capabilities instead of ‘administrator’ role. More – you can replace those capabilities directly or using custom filters without changing Avada’s source code.
Look at the source code:

The code above was written and tested with Avada version 5.0.5.

Share