add_settings_error fixes. Props jeremyclarke. fixes #11474

git-svn-id: https://develop.svn.wordpress.org/trunk@13197 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-02-18 19:43:44 +00:00
parent 2bf79cc5e8
commit 15f2f0bda1
2 changed files with 6 additions and 6 deletions

View File

@ -3125,11 +3125,11 @@ function do_settings_fields($page, $section) {
* @global array $wp_settings_errors Storage array of errors registered during this pageload
*
* @param string $setting Slug title of the setting to which this error applies
* @param string $id Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
* @param string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
* @param string $message The formatted message text to display to the user (will be shown inside styled <div> and <p>)
* @param string $type The type of message it is, controls HTML class. Use 'error' or 'updated'.
*/
function add_settings_error( $setting, $id, $message, $type = 'error' ) {
function add_settings_error( $setting, $code, $message, $type = 'error' ) {
global $wp_settings_errors;
if ( !isset($wp_settings_errors) )
@ -3137,7 +3137,7 @@ function add_settings_error( $setting, $id, $message, $type = 'error' ) {
$new_error = array(
'setting' => $setting,
'title' => $title, // @todo $title not defined. Use $id instead?
'code' => $code,
'message' => $message,
'type' => $type
);
@ -3225,7 +3225,7 @@ function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = F
$output = '';
foreach ( $settings_errors as $key => $details ) {
$css_id = 'setting-error-' . $details['title'];
$css_id = 'setting-error-' . $details['code'];
$css_class = $details['type'] . ' fade settings-error';
$output .= "<div id='$css_id' class='$css_class'> \n";
$output .= "<p><strong>{$details['message']}</strong></p>";

View File

@ -2380,9 +2380,9 @@ function sanitize_option($option, $value) {
switch ($option) {
case 'admin_email':
if ( !$value = sanitize_email($value) && function_exists('add_settings_error') )
$value = sanitize_email($value);
if ( !$value && function_exists('add_settings_error') )
add_settings_error('admin_email', 'invalid_admin_email', __('The E-Mail Address submitted was not in the right format. Please enter a valid Email Address'));
break;
case 'thumbnail_size_w':