add_settings_error fixes. Props jeremyclarke. fixes #11474
git-svn-id: http://svn.automattic.com/wordpress/trunk@13197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c62a99c820
commit
3878927045
|
@ -3125,11 +3125,11 @@ function do_settings_fields($page, $section) {
|
||||||
* @global array $wp_settings_errors Storage array of errors registered during this pageload
|
* @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 $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 $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'.
|
* @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;
|
global $wp_settings_errors;
|
||||||
|
|
||||||
if ( !isset($wp_settings_errors) )
|
if ( !isset($wp_settings_errors) )
|
||||||
|
@ -3137,7 +3137,7 @@ function add_settings_error( $setting, $id, $message, $type = 'error' ) {
|
||||||
|
|
||||||
$new_error = array(
|
$new_error = array(
|
||||||
'setting' => $setting,
|
'setting' => $setting,
|
||||||
'title' => $title, // @todo $title not defined. Use $id instead?
|
'code' => $code,
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
'type' => $type
|
'type' => $type
|
||||||
);
|
);
|
||||||
|
@ -3225,7 +3225,7 @@ function settings_errors ( $setting = '', $sanitize = FALSE, $hide_on_update = F
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach ( $settings_errors as $key => $details ) {
|
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';
|
$css_class = $details['type'] . ' fade settings-error';
|
||||||
$output .= "<div id='$css_id' class='$css_class'> \n";
|
$output .= "<div id='$css_id' class='$css_class'> \n";
|
||||||
$output .= "<p><strong>{$details['message']}</strong></p>";
|
$output .= "<p><strong>{$details['message']}</strong></p>";
|
||||||
|
|
|
@ -2380,9 +2380,9 @@ function sanitize_option($option, $value) {
|
||||||
|
|
||||||
switch ($option) {
|
switch ($option) {
|
||||||
case 'admin_email':
|
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'));
|
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;
|
break;
|
||||||
|
|
||||||
case 'thumbnail_size_w':
|
case 'thumbnail_size_w':
|
||||||
|
|
Loading…
Reference in New Issue