WordPress.org

Make WordPress Core

Ticket #11474: settings_api_errors_update-13196.diff

File settings_api_errors_update-13196.diff, 2.2 KB (added by jeremyclarke, 12 years ago)

Fix bugs in Settings API Errors patch

  • wp-admin/includes/template.php

     
    31253125 * @global array $wp_settings_errors Storage array of errors registered during this pageload
    31263126 *
    31273127 * @param string $setting Slug title of the setting to which this error applies
    3128  * @param string $id Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
     3128 * @param string $code Slug-name to identify the error. Used as part of 'id' attribute in HTML output.
    31293129 * @param string $message The formatted message text to display to the user (will be shown inside styled <div> and <p>)
    31303130 * @param string $type The type of message it is, controls HTML class. Use 'error' or 'updated'.
    31313131 */
    3132 function add_settings_error( $setting, $id, $message, $type = 'error' ) {
     3132function add_settings_error( $setting, $code, $message, $type = 'error' ) {
    31333133        global $wp_settings_errors;
    31343134
    31353135        if ( !isset($wp_settings_errors) )
     
    31373137
    31383138        $new_error = array(
    31393139                'setting' => $setting,
    3140                 'title' => $title, // @todo $title not defined. Use $id instead?
     3140                'code' => $code,
    31413141                'message' => $message,
    31423142                'type' => $type
    31433143        );
     
    32253225
    32263226        $output = '';
    32273227        foreach ( $settings_errors as $key => $details ) {
    3228                 $css_id = 'setting-error-' . $details['title'];
     3228                $css_id = 'setting-error-' . $details['code'];
    32293229                $css_class = $details['type'] . ' fade settings-error';
    32303230                $output .= "<div id='$css_id' class='$css_class'> \n";
    32313231                $output .= "<p><strong>{$details['message']}</strong></p>";
  • wp-includes/formatting.php

     
    23802380
    23812381        switch ($option) {
    23822382                case 'admin_email':
    2383                         if ( !$value = sanitize_email($value) && function_exists('add_settings_error') )
     2383                        $value = sanitize_email($value);
     2384                        if ( !$value && function_exists('add_settings_error') )
    23842385                                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'));
    2385 
    23862386                        break;
    23872387
    23882388                case 'thumbnail_size_w':