Merge pull request #29613 from woocommerce/fix/29567
Don't show the "WooCommerce Setup" widget in dashboard if WC Admin is disabled
This commit is contained in:
commit
a8572e755c
|
@ -162,7 +162,9 @@ if ( ! class_exists( 'WC_Admin_Dashboard_Setup', false ) ) :
|
|||
* @return bool
|
||||
*/
|
||||
private function should_display_widget() {
|
||||
return 'yes' !== get_option( 'woocommerce_task_list_complete' ) && 'yes' !== get_option( 'woocommerce_task_list_hidden' );
|
||||
return WC()->is_wc_admin_active() &&
|
||||
'yes' !== get_option( 'woocommerce_task_list_complete' ) &&
|
||||
'yes' !== get_option( 'woocommerce_task_list_hidden' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,6 +63,10 @@ if ( ! class_exists( 'WC_Admin_Dashboard', false ) ) :
|
|||
* @return bool
|
||||
*/
|
||||
private function should_display_widget() {
|
||||
if ( ! WC()->is_wc_admin_active() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$has_permission = current_user_can( 'view_woocommerce_reports' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'publish_shop_orders' );
|
||||
$task_completed_or_hidden = 'yes' === get_option( 'woocommerce_task_list_complete' ) || 'yes' === get_option( 'woocommerce_task_list_hidden' );
|
||||
return $task_completed_or_hidden && $has_permission;
|
||||
|
|
Loading…
Reference in New Issue