Backwards compat for plugin use of updated=1. fixes #15660
git-svn-id: https://develop.svn.wordpress.org/trunk@16706 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
96e0e3b82f
commit
2158fc7445
@ -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 );
|
||||
|
||||
|
@ -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();
|
||||
|
||||
?>
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user