if ( 'namelf' ===
$idmode ) { $id =
$user->user_lastname . ' ' .
$user->user_firstname;
} if ( !
$idmode ) { $id =
$user->user_nickname;
} $wpdb->
update( $wpdb->users, array
( 'display_name' =>
$id ), array
( 'ID' =>
$user->ID
) );
endif;
// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
$caps =
get_user_meta( $user->ID,
$wpdb->prefix . 'capabilities'
);
if ( empty( $caps ) ||
defined( 'RESET_CAPS'
) ) { $level =
get_user_meta( $user->ID,
$wpdb->prefix . 'user_level', true
);
$role =
translate_level_to_role( $level );
update_user_meta( $user->ID,
$wpdb->prefix . 'capabilities', array
( $role => true
) );
} 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', 'user_level'
);
$wpdb->
hide_errors();
foreach ( $old_user_fields as $old ) { $wpdb->
query( "ALTER TABLE
$wpdb->users DROP
$old"
);
}