WordPress.org

Make WordPress Core

Ticket #5263: 5263.patch

File 5263.patch, 1.1 KB (added by pishmishy, 7 years ago)

Patch handles errors gracefully

  • wp-admin/profile-update.php

     
    1313 
    1414if ( is_wp_error( $errors ) ) { 
    1515        foreach( $errors->get_error_messages() as $message ) 
    16                 echo "$message<br />"; 
     16                $error_msg .= "$message<br/>"; 
     17        update_option("profile-update-error",$error_msg); 
     18        $to = 'profile.php?error=true'; 
     19        wp_redirect( $to ); 
    1720        exit; 
    1821} 
    1922 
  • wp-admin/profile.php

     
    1818<p><strong><?php _e('Profile updated.') ?></strong></p> 
    1919</div> 
    2020<?php } ?> 
     21<?php if ( isset($_GET['error']) ) { ?> 
     22<div id="message" class="error fade"> 
     23<p><strong> 
     24<?php  
     25        echo get_option("profile-update-error"); 
     26        delete_option("profile-update-error"); 
     27?> 
    2128 
     29 
     30</strong></p> 
     31</div> 
     32<?php } ?> 
     33 
    2234<div class="wrap"> 
    2335<h2><?php _e('Your Profile and Personal Options'); ?></h2> 
    2436<form name="profile" id="your-profile" action="profile-update.php" method="post">