Permalink
Browse files

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
  • Loading branch information...
1 parent 47cfe8d commit 7aa5cb911e4a9782de2fb5d30e649df6e84327c6 markjaquith committed Dec 3, 2010
Showing with 9 additions and 4 deletions.
  1. +3 −3 wp-admin/includes/template.php
  2. +5 −0 wp-admin/options-head.php
  3. +1 −1 wp-admin/options.php
View
6 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 );
View
5 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();
?>
View
2 wp-admin/options.php
@@ -157,7 +157,7 @@
/**
* 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;
}

0 comments on commit 7aa5cb9

Please sign in to comment.