From 7aa5cb911e4a9782de2fb5d30e649df6e84327c6 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Fri, 3 Dec 2010 10:59:20 +0000 Subject: [PATCH] Backwards compat for plugin use of updated=1. fixes #15660 git-svn-id: http://svn.automattic.com/wordpress/trunk@16706 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 6 +++--- wp-admin/options-head.php | 5 +++++ wp-admin/options.php | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 982c87337d..2ad321de7b 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1238,7 +1238,7 @@ function add_settings_error( $setting, $code, $message, $type = 'error' ) { * Checks the $wp_settings_errors array for any errors declared during the current * pageload and returns them. * - * If changes were just submitted ($_GET['updated']) and settings errors were saved + * If changes were just submitted ($_GET['settings-updated']) and settings errors were saved * to the 'settings_errors' transient then those errors will be returned instead. This * is used to pass errors back across pageloads. * @@ -1265,7 +1265,7 @@ function get_settings_errors( $setting = '', $sanitize = FALSE ) { // If settings were passed back from options.php then use them // Ignore transients if $sanitize is true, we dont' want the old values anyway - if ( isset($_GET['updated']) && $_GET['updated'] && get_transient('settings_errors') ) { + if ( isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors') ) { $settings_errors = get_transient('settings_errors'); delete_transient('settings_errors'); // Otherwise check global in case validation has been run on this pageload @@ -1308,7 +1308,7 @@ function get_settings_errors( $setting = '', $sanitize = FALSE ) { */ function settings_errors( $setting = '', $sanitize = FALSE, $hide_on_update = FALSE ) { - if ($hide_on_update AND $_GET['updated']) return; + if ($hide_on_update AND $_GET['settings-updated']) return; $settings_errors = get_settings_errors( $setting, $sanitize ); diff --git a/wp-admin/options-head.php b/wp-admin/options-head.php index 965615fd46..7f2cc74d08 100644 --- a/wp-admin/options-head.php +++ b/wp-admin/options-head.php @@ -11,6 +11,11 @@ wp_reset_vars(array('action', 'standalone', 'option_group_id')); +if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) { + // For backwards compat with plugins that don't use the Settings API and just set updated=1 in the redirect + add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated'); +} + settings_errors(); ?> \ No newline at end of file diff --git a/wp-admin/options.php b/wp-admin/options.php index 672535ae18..c610715eee 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -157,7 +157,7 @@ if ( 'update' == $action ) { /** * Redirect back to the settings page that was submitted */ - $goback = add_query_arg( 'updated', 'true', wp_get_referer() ); + $goback = add_query_arg( 'settings-updated', 'true', wp_get_referer() ); wp_redirect( $goback ); exit; }