From 8e6a35d1f17b71038369718d52de0b485c69e931 Mon Sep 17 00:00:00 2001 From: Jeffrey Schutzman Date: Sun, 4 May 2014 16:15:43 -0400 Subject: [PATCH] Nag store admin to check store settings after upgrade * also adds a general administrator nag class to our repertoire to make future nagging and error reporting that much more fun Addresses issues #1272 and #1270 --- wpsc-admin/db-upgrades/routines/14.php | 30 +++ wpsc-core/wpsc-includes.php | 1 + .../wpsc-admin-notifications.class.php | 174 ++++++++++++++++++ 3 files changed, 205 insertions(+) create mode 100644 wpsc-admin/db-upgrades/routines/14.php create mode 100644 wpsc-includes/wpsc-admin-notifications.class.php diff --git a/wpsc-admin/db-upgrades/routines/14.php b/wpsc-admin/db-upgrades/routines/14.php new file mode 100644 index 0000000000..372845373d --- /dev/null +++ b/wpsc-admin/db-upgrades/routines/14.php @@ -0,0 +1,30 @@ +
The visibility of the checkout billing and shipping + drop downs that show states and provinces is now controlled by the "billingstate" and "shippingstate" + options set in the Store Settings on the Checkout tab. Prior versions used + the "billingcountry" and "shippingcountry" settings to control the visibility of the drop downs.', + 'wpsc' + ) + ); +} diff --git a/wpsc-core/wpsc-includes.php b/wpsc-core/wpsc-includes.php index ac9300f6aa..fb256404be 100644 --- a/wpsc-core/wpsc-includes.php +++ b/wpsc-core/wpsc-includes.php @@ -4,6 +4,7 @@ require_once( WPSC_FILE_PATH . '/wpsc-core/wpsc-deprecated.php' ); // Start including the rest of the plugin here +require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-admin-notifications.class.php' ); require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-meta-util.php' ); require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-checkout-localization.php' ); require_once( WPSC_FILE_PATH . '/wpsc-includes/wpsc-checkout-ajax.php' ); diff --git a/wpsc-includes/wpsc-admin-notifications.class.php b/wpsc-includes/wpsc-admin-notifications.class.php new file mode 100644 index 0000000000..486602e25d --- /dev/null +++ b/wpsc-includes/wpsc-admin-notifications.class.php @@ -0,0 +1,174 @@ +show_messages(); + } + } + + /** + * display admin messages(nags) + * + * @since 3.8.14.1 + */ + function show_messages() { + $messages = get_option( __CLASS__ , array() ); + + static $script_already_sent = false; + static $already_displayed = array(); + + // first time though this function and we should add the admin nag script to the page + if ( ! $script_already_sent ) { + ?> + + $message ) { + if ( in_array( $id, $already_displayed ) ) + continue; + + $already_displayed[] = $id; + + + ?> +
+
+

+ +

+
+
+ +
+
+ new_message( $messages ); +} + + + +// If we are showing an admin page we want to show the admin nags +if ( is_admin() ) { + $wpsc_admin_notifications = new WPSC_Admin_Notifications(); +} +