diff --git a/inc/spbc-admin.php b/inc/spbc-admin.php index 5ac151b28..d03f2a52c 100644 --- a/inc/spbc-admin.php +++ b/inc/spbc-admin.php @@ -1007,7 +1007,6 @@ function spbc_admin__change_plugin_description($all_plugins) return $all_plugins; } - /** * Add the statistics widget to the dashboard. * @return void @@ -1022,7 +1021,16 @@ function spbc_dashboard_statistics_widget() $actual_plugin_name = $spbc->data['wl_brandname']; } - if ( current_user_can('activate_plugins') ) { + /** + * Hook. List of allowed user roles for the Dashboard widget. + * add_filter('spbct_hook_dashboard_widget_allowed_roles_list', function($roles_list) { + * $roles_list[] = 'editor'; + * return $roles_list; + * }); + */ + $roles_list = apply_filters('spbct_hook_dashboard_widget_allowed_roles_list', array('administrator')); + + if ( is_array($roles_list) && spbc_is_user_role_in($roles_list) ) { wp_add_dashboard_widget( 'spbc_dashboard_statistics_widget', $actual_plugin_name, @@ -1051,29 +1059,35 @@ function spbc_dashboard_statistics_widget_output($_post, $_callback_args)