Permalink
Browse files

Moved notice inline

  • Loading branch information...
1 parent 054ca02 commit d14fccf69492749f52661a6d2efff81717afdcbc @mikejolley mikejolley committed Feb 18, 2012
Showing with 14 additions and 20 deletions.
  1. +0 −19 admin/woocommerce-admin-init.php
  2. +8 −1 admin/woocommerce-admin-settings.php
  3. +1 −0 assets/css/admin.css
  4. +5 −0 assets/css/admin.less
@@ -82,25 +82,6 @@ function woocommerce_admin_notices_styles() {
}
}
-/**
- * Notices to prevent user error
- */
-add_action( 'admin_notices', 'woocommerce_admin_notices' );
-
-function woocommerce_admin_notices() {
-
- if (!isset($_GET['page']) || $_GET['page']!=='woocommerce') return;
-
- // Error notice when prepending urls with shop
- $shop_page_id = woocommerce_get_page_id('shop');
-
- if ( get_option('woocommerce_prepend_shop_page_to_products')=='yes' && $shop_page_id > 0 && sizeof(get_pages("child_of=$shop_page_id")) > 0 ) {
-
- echo '<div class="error fade"><p><strong>'.__('You have chosen to prepend product permalinks with the shop page, but the shop page has children. Child pages will show 404\'s unless changed.', 'woocommerce').'</strong></p></div>';
-
- }
-}
-
/**
* Admin Includes - loaded conditionally
@@ -261,8 +261,15 @@
)); // End general settings
+// Get shop page
$shop_page_id = woocommerce_get_page_id('shop');
+
$base_slug = ($shop_page_id > 0 && get_page( $shop_page_id )) ? get_page_uri( $shop_page_id ) : 'shop';
+
+$woocommerce_prepend_shop_page_to_products_warning = '';
+
+if ( $shop_page_id > 0 && sizeof(get_pages("child_of=$shop_page_id")) > 0 )
+ $woocommerce_prepend_shop_page_to_products_warning = ' <mark class="notice">' . __('Note: The shop page has children - child pages will not work if you enable this option.', 'woocommerce') . '</mark>';
$woocommerce_settings['pages'] = apply_filters('woocommerce_page_settings', array(
@@ -338,7 +345,7 @@
array(
'name' => __( 'Product base page', 'woocommerce' ),
- 'desc' => sprintf(__( 'Prepend product permalinks with shop base page (<code>%s</code>)', 'woocommerce' ), $base_slug),
+ 'desc' => sprintf(__( 'Prepend product permalinks with shop base page (<code>%s</code>)', 'woocommerce' ), $base_slug) . $woocommerce_prepend_shop_page_to_products_warning,
'id' => 'woocommerce_prepend_shop_page_to_products',
'std' => 'yes',
'type' => 'checkbox',
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -814,6 +814,11 @@ ul.recent-orders, ul.stock_list {
}
/* Settings */
+mark.notice {
+ background: #fff;
+ color: red;
+ margin: 0 0 0 10px;
+}
a.export_rates, a.import_rates {
float:right;
margin-left: 3px;

0 comments on commit d14fccf

Please sign in to comment.