Set display_name only if the user table still containts id_mode. This prevents multiple upgrades from stomping display_name.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-06-16 06:14:07 +00:00
parent ee3e50ff3d
commit f220786deb
1 changed files with 13 additions and 10 deletions

View File

@ -238,6 +238,8 @@ function upgrade_160() {
update_usermeta( $user->ID, 'yim', addslashes($user->user_icq) );
if ( !empty( $user->user_description ) )
update_usermeta( $user->ID, 'description', addslashes($user->user_description) );
if ( !isset( $user->user_idmode ) ):
$idmode = $user->user_idmode;
if ($idmode == 'nickname') $id = $user->user_nickname;
if ($idmode == 'login') $id = $user->user_login;
@ -248,6 +250,7 @@ function upgrade_160() {
if (!$idmode) $id = $user->user_nickname;
$id = addslashes( $id );
$wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
endif;
endforeach;
$old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname' );
$wpdb->hide_errors();