Dashboard widgets only viewable by admin

This commit is contained in:
Mike Jolley 2011-09-22 14:00:29 +01:00
parent 0b1b8836cc
commit 215e28a1e0
1 changed files with 8 additions and 9 deletions

View File

@ -7,12 +7,17 @@
* @package WooCommerce
*/
// Only hook in admin parts if the user has admin access
if (current_user_can('manage_woocommerce')) :
add_action('right_now_content_table_end', 'woocommerce_content_right_now');
add_action('right_now_table_end', 'woocommerce_right_now');
add_action('wp_dashboard_setup', 'woocommerce_init_dashboard_widgets' );
add_action('admin_footer', 'woocommmerce_dashboard_sales_js');
endif;
/**
* Right now widget hooks/content
*/
add_action('right_now_content_table_end', 'woocommerce_content_right_now');
add_action('right_now_table_end', 'woocommerce_right_now');
function woocommerce_content_right_now() {
global $woocommerce;
@ -78,8 +83,6 @@ function woocommerce_right_now() {
/**
* Dashboard Widgets - init
*/
add_action('wp_dashboard_setup', 'woocommerce_init_dashboard_widgets' );
function woocommerce_init_dashboard_widgets() {
global $current_month_offset;
@ -310,7 +313,3 @@ function woocommmerce_dashboard_sales_js() {
wp_print_scripts('woocommerce_dashboard_sales');
}
add_action('admin_footer', 'woocommmerce_dashboard_sales_js');