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
This commit is contained in:
markjaquith 2010-12-03 10:59:20 +00:00
parent 47cfe8dd05
commit 7aa5cb911e
3 changed files with 9 additions and 4 deletions

View File

@ -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 File

@ -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 File

@ -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;
}