Load js when needed only. Closes #1060.

This commit is contained in:
Mike Jolley 2012-06-09 20:26:03 +01:00
parent 383785c305
commit 516aad8450
2 changed files with 5 additions and 3 deletions

View File

@ -9,8 +9,7 @@
// Only hook in admin parts if the user has admin access
if (current_user_can('view_woocommerce_reports') || current_user_can('manage_woocommerce_orders')|| current_user_can('manage_woocommerce')) :
add_action('wp_dashboard_setup', 'woocommerce_init_dashboard_widgets' );
add_action('admin_footer', 'woocommerce_dashboard_sales_js');
add_action( 'wp_dashboard_setup', 'woocommerce_init_dashboard_widgets' );
endif;
/**
@ -296,7 +295,9 @@ function orders_this_month( $where = '' ) {
* Sales widget
*/
function woocommerce_dashboard_sales() {
add_action( 'admin_footer', 'woocommerce_dashboard_sales_js' );
?><div id="placeholder" style="width:100%; height:300px; position:relative;"></div><?php
}

View File

@ -179,6 +179,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Prevent double add to cart with related products
* Fix - Out of base tax rounding
* Fix - Backorders for variations allow more than stock to be purchased now
* Fix - Conflict with compfight.
* Localization - Updated localisations
* Localization - Updated currency symbols
* Localization - translations for admin menu names