update default capability for analytics report to view_woocommerce_reports

This commit is contained in:
Ron Rennick 2019-05-10 14:34:45 -03:00
parent 54a09ab232
commit e9aa903fc6
2 changed files with 7 additions and 4 deletions

View File

@ -21,13 +21,15 @@ if ( ! function_exists( 'wc_admin_register_page' ) ) {
function wc_admin_register_page( $options ) {
$defaults = array(
'parent' => '/analytics',
'capability' => 'view_woocommerce_reports',
);
$options = wp_parse_args( $options, $defaults );
add_submenu_page(
'/' === $options['parent'][0] ? "wc-admin#{$options['parent']}" : $options['parent'],
$options['title'],
$options['title'],
'manage_options',
$options['capability'],
"wc-admin#{$options['path']}",
array( 'WC_Admin_Loader', 'page_wrapper' )
);
@ -171,11 +173,12 @@ class WC_Admin_Loader {
$menu_title = __( 'Dashboard', 'woocommerce-admin' );
}
$analytics_cap = apply_filters( 'woocommerce_admin_analytics_menu_capability', 'view_woocommerce_reports' );
add_submenu_page(
'woocommerce',
$page_title,
$menu_title,
'manage_options',
$analytics_cap,
'wc-admin',
array( 'WC_Admin_Loader', 'page_wrapper' )
);

View File

@ -76,7 +76,7 @@ class WC_Admin_Analytics {
add_menu_page(
__( 'WooCommerce Analytics', 'woocommerce-admin' ),
__( 'Analytics', 'woocommerce-admin' ),
'manage_options',
'view_woocommerce_reports',
'wc-admin#/analytics/revenue',
array( 'WC_Admin_Loader', 'page_wrapper' ),
'dashicons-chart-bar',