User data migration should be complete

git-svn-id: http://svn.automattic.com/wordpress/trunk@2636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
matt 2005-06-13 08:32:44 +00:00
parent 8f00d317de
commit 1f9a608be9
13 changed files with 103 additions and 147 deletions

View File

@ -150,16 +150,17 @@ if ('publish' != $post_status || 0 == $post_ID) {
<th scope="row" width="25%"><?php _e('Post slug') ?>:</th> <th scope="row" width="25%"><?php _e('Post slug') ?>:</th>
<td><input name="post_name" type="text" size="25" id="post_name" value="<?php echo $post_name ?>" /></td> <td><input name="post_name" type="text" size="25" id="post_name" value="<?php echo $post_name ?>" /></td>
</tr> </tr>
<?php if ($user_level > 7 && $users = $wpdb->get_results("SELECT ID, user_login, user_firstname, user_lastname FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?> <?php if ($user_level > 7 && $users = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?>
<tr> <tr>
<th scope="row"><?php _e('Post author'); ?>:</th> <th scope="row"><?php _e('Post author'); ?>:</th>
<td> <td>
<select name="post_author_override" id="post_author_override"> <select name="post_author_override" id="post_author_override">
<?php <?php
foreach ($users as $o) : foreach ($users as $o) :
$o = get_userdata( $o->ID );
if ( $post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"'; if ( $post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
else $selected = ''; else $selected = '';
echo "<option value='$o->ID' $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>"; echo "<option value='$o->ID' $selected>$o->user_login ($o->first_name $o->last_name)</option>";
endforeach; endforeach;
?> ?>
</select> </select>

View File

@ -108,16 +108,17 @@ edCanvas = document.getElementById('content');
<th scope="row" width="30%"><?php _e('Page slug') ?>:</th> <th scope="row" width="30%"><?php _e('Page slug') ?>:</th>
<td><input name="post_name" type="text" size="25" id="post_name" value="<?php echo $post_name ?>" /></td> <td><input name="post_name" type="text" size="25" id="post_name" value="<?php echo $post_name ?>" /></td>
</tr> </tr>
<?php if ($user_level > 7 && $users = $wpdb->get_results("SELECT ID, user_login, user_firstname, user_lastname FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?> <?php if ($user_level > 7 && $users = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?>
<tr> <tr>
<th scope="row" width="30%"><?php _e('Page owner'); ?>:</th> <th scope="row" width="30%"><?php _e('Page owner'); ?>:</th>
<td> <td>
<select name="post_author" id="post_author"> <select name="post_author" id="post_author">
<?php <?php
foreach ($users as $o) : foreach ($users as $o) :
$o = get_userdata( $O->ID );
if ( $post_author == $o->ID ) $selected = 'selected="selected"'; if ( $post_author == $o->ID ) $selected = 'selected="selected"';
else $selected = ''; else $selected = '';
echo "<option value='$o->ID' $selected>$o->user_login ($o->user_firstname $o->user_lastname)</option>"; echo "<option value='$o->ID' $selected>$o->user_login ($o->first_name $o->last_name)</option>";
endforeach; endforeach;
?> ?>
</select> </select>

View File

@ -66,13 +66,9 @@ case "step1":
// we'll check the author is registered already // we'll check the author is registered already
$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"); $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'");
if (!$user) { // seems s/he's not, so let's register if (!$user) { // seems s/he's not, so let's register
$user_ip = '127.0.0.1';
$user_domain = 'localhost';
$user_browser = 'server';
$user_joindate = '1979-06-06 00:41:00'; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!) $user_joindate = '1979-06-06 00:41:00'; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!)
$user_login = addslashes($post_author); $user_login = addslashes($post_author);
$pass1 = addslashes('password'); $pass1 = addslashes('password');
$user_nickname = addslashes($post_author);
$user_email = addslashes('user@wordpress.org'); $user_email = addslashes('user@wordpress.org');
$user_url = addslashes(''); $user_url = addslashes('');
$user_joindate = addslashes($user_joindate); $user_joindate = addslashes($user_joindate);
@ -80,27 +76,17 @@ case "step1":
INSERT INTO $wpdb->users ( INSERT INTO $wpdb->users (
user_login, user_login,
user_pass, user_pass,
user_nickname,
user_email, user_email,
user_url, user_url,
user_ip,
user_domain,
user_browser,
user_registered, user_registered,
user_level, user_level,
user_idmode
) VALUES ( ) VALUES (
'$user_login', '$user_login',
'$pass1', '$pass1',
'$user_nickname',
'$user_email', '$user_email',
'$user_url', '$user_url',
'$user_ip',
'$user_domain',
'$user_browser',
'$user_joindate', '$user_joindate',
'1', '1',
'nickname'
)"); )");
echo ": Registered user <strong>$user_login</strong>"; echo ": Registered user <strong>$user_login</strong>";

View File

@ -87,10 +87,6 @@ case "step1":
foreach($userbase as $user) { foreach($userbase as $user) {
$userdata=explode("|", $user); $userdata=explode("|", $user);
$user_ip="127.0.0.1";
$user_domain="localhost";
$user_browser="server";
$s=$userdata[4]; $s=$userdata[4];
$user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00"; $user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";
@ -107,7 +103,7 @@ case "step1":
continue; continue;
} }
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')"; $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_email,user_url,user_registered,user_level) VALUES ('$user_login','$pass1','$user_email','$user_url','$user_joindate','1')";
$result = $wpdb->query($query); $result = $wpdb->query($query);
if ($result==false) { if ($result==false) {
die ("<strong>ERROR</strong>: couldn't register an user!"); die ("<strong>ERROR</strong>: couldn't register an user!");
@ -156,9 +152,6 @@ case "step1":
$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"; $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
$result = $wpdb->query($sql); $result = $wpdb->query($sql);
if (! $result) { // if deleted from GM, we register the author as a level 0 user in wp if (! $result) { // if deleted from GM, we register the author as a level 0 user in wp
$user_ip="127.0.0.1";
$user_domain="localhost";
$user_browser="server";
$user_joindate="1979-06-06 00:41:00"; $user_joindate="1979-06-06 00:41:00";
$user_login=addslashes($post_author); $user_login=addslashes($post_author);
$pass1=addslashes("password"); $pass1=addslashes("password");
@ -166,7 +159,7 @@ case "step1":
$user_email=addslashes("user@deleted.com"); $user_email=addslashes("user@deleted.com");
$user_url=addslashes(""); $user_url=addslashes("");
$user_joindate=addslashes($user_joindate); $user_joindate=addslashes($user_joindate);
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')"; $query = "INSERT INTO $wpdb->users (user_login,user_pass,user_email,user_url,user_registered,user_level) VALUES ('$user_login','$pass1','$user_email','$user_url','$user_joindate','0')";
$result = $wpdb->query($query); $result = $wpdb->query($query);
if ($result==false) { if ($result==false) {
die ("<strong>ERROR</strong>: couldn't register an user!"); die ("<strong>ERROR</strong>: couldn't register an user!");

View File

@ -72,6 +72,7 @@ case 'update':
$newuser_firstname = wp_specialchars($_POST['newuser_firstname']); $newuser_firstname = wp_specialchars($_POST['newuser_firstname']);
$newuser_lastname = wp_specialchars($_POST['newuser_lastname']); $newuser_lastname = wp_specialchars($_POST['newuser_lastname']);
$new_display_name = wp_specialchars($_POST['display_name']);
$newuser_nickname = $_POST['newuser_nickname']; $newuser_nickname = $_POST['newuser_nickname'];
$newuser_nicename = sanitize_title($newuser_nickname); $newuser_nicename = sanitize_title($newuser_nickname);
$newuser_icq = wp_specialchars($_POST['newuser_icq']); $newuser_icq = wp_specialchars($_POST['newuser_icq']);
@ -81,19 +82,18 @@ case 'update':
$newuser_email = wp_specialchars($_POST['newuser_email']); $newuser_email = wp_specialchars($_POST['newuser_email']);
$newuser_url = wp_specialchars($_POST['newuser_url']); $newuser_url = wp_specialchars($_POST['newuser_url']);
$newuser_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $newuser_url) ? $newuser_url : 'http://' . $newuser_url; $newuser_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $newuser_url) ? $newuser_url : 'http://' . $newuser_url;
$newuser_idmode = wp_specialchars($_POST['newuser_idmode']);
$user_description = $_POST['user_description']; $user_description = $_POST['user_description'];
$result = $wpdb->query("UPDATE $wpdb->users SET $updatepassword user_email='$newuser_email', user_url='$newuser_url', user_nicename = '$newuser_nicename' WHERE ID = $user_ID"); $result = $wpdb->query("UPDATE $wpdb->users SET $updatepassword user_email='$newuser_email', user_url='$newuser_url', user_nicename = '$newuser_nicename', display_name = '$new_display_name' WHERE ID = $user_ID");
update_user_meta( $user_ID, 'first_name', $newuser_firstname ); update_usermeta( $user_ID, 'first_name', $newuser_firstname );
update_user_meta( $user_ID, 'last_name', $newuser_lastname ); update_usermeta( $user_ID, 'last_name', $newuser_lastname );
update_user_meta( $user_ID, 'nickname', $newuser_nickname ); update_usermeta( $user_ID, 'nickname', $newuser_nickname );
update_user_meta( $user_ID, 'description', $user_description ); update_usermeta( $user_ID, 'description', $user_description );
update_user_meta( $user_ID, 'icq', $newuser_icq ); update_usermeta( $user_ID, 'icq', $newuser_icq );
update_user_meta( $user_ID, 'aim', $newuser_aim ); update_usermeta( $user_ID, 'aim', $newuser_aim );
update_user_meta( $user_ID, 'msn', $newuser_msn ); update_usermeta( $user_ID, 'msn', $newuser_msn );
update_user_meta( $user_ID, 'yim', $newuser_yim ); update_usermeta( $user_ID, 'yim', $newuser_yim );
do_action('profile_update', $user_ID); do_action('profile_update', $user_ID);
@ -136,10 +136,11 @@ break;
default: default:
$parent_file = 'profile.php'; $parent_file = 'profile.php';
include_once('admin-header.php'); include_once('admin-header.php');
$profiledata=get_userdata($user_ID); $profiledata = get_userdata($user_ID);
$bookmarklet_height= 440; $bookmarklet_height= 440;
var_dump( $profiledata );
if (isset($updated)) { ?> if (isset($updated)) { ?>
<div class="updated"> <div class="updated">
<p><strong><?php _e('Profile updated.') ?></strong></p> <p><strong><?php _e('Profile updated.') ?></strong></p>
@ -171,44 +172,32 @@ if (isset($updated)) { ?>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('First name:') ?></th> <th scope="row"><?php _e('First name:') ?></th>
<td><input type="text" name="newuser_firstname" id="newuser_firstname" value="<?php echo $profiledata->user_firstname ?>" /></td> <td><input type="text" name="newuser_firstname" id="newuser_firstname" value="<?php echo $profiledata->first_name ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Last name:') ?></th> <th scope="row"><?php _e('Last name:') ?></th>
<td><input type="text" name="newuser_lastname" id="newuser_lastname2" value="<?php echo $profiledata->user_lastname ?>" /></td> <td><input type="text" name="newuser_lastname" id="newuser_lastname2" value="<?php echo $profiledata->last_name ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Nickname:') ?></th> <th scope="row"><?php _e('Nickname:') ?></th>
<td><input type="text" name="newuser_nickname" id="newuser_nickname2" value="<?php echo $profiledata->user_nickname ?>" /></td> <td><input type="text" name="newuser_nickname" id="newuser_nickname2" value="<?php echo $profiledata->nickname ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('How to display name:') ?> </th> <th scope="row"><?php _e('How to display name:') ?> </th>
<td><select name="newuser_idmode"> <td>
<option value="nickname"<?php <select name="display_name">
if ($profiledata->user_idmode == 'nickname') <option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option>
echo ' selected="selected"'; ?>><?php echo $profiledata->user_nickname ?></option> <option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option>
<option value="login"<?php <option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option>
if ($profiledata->user_idmode=="login") <?php if ( !empty( $profiledata->first_name ) ) : ?>
echo ' selected="selected"'; ?>><?php echo $profiledata->user_login ?></option> <option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option>
<?php if ( !empty( $profiledata->user_firstname ) ) : ?>
<option value="firstname"<?php
if ($profiledata->user_idmode=="firstname")
echo ' selected="selected"'; ?>><?php echo $profiledata->user_firstname ?></option>
<?php endif; ?> <?php endif; ?>
<?php if ( !empty( $profiledata->user_lastname ) ) : ?> <?php if ( !empty( $profiledata->last_name ) ) : ?>
<option value="lastname"<?php <option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option>
if ($profiledata->user_idmode=="lastname")
echo ' selected="selected"'; ?>><?php echo $profiledata->user_lastname ?></option>
<?php endif; ?> <?php endif; ?>
<?php if ( !empty( $profiledata->user_firstname ) && !empty( $profiledata->user_lastname ) ) : ?> <?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
<option value="namefl"<?php <option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
if ($profiledata->user_idmode=="namefl") <option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
echo ' selected="selected"'; ?>><?php echo $profiledata->user_firstname." ".$profiledata->user_lastname ?></option>
<?php endif; ?>
<?php if ( !empty( $profiledata->user_firstname ) && !empty( $profiledata->user_lastname ) ) : ?>
<option value="namelf"<?php
if ($profiledata->user_idmode=="namelf")
echo ' selected="selected"'; ?>><?php echo $profiledata->user_lastname." ".$profiledata->user_firstname ?></option>
<?php endif; ?> <?php endif; ?>
</select> </td> </select> </td>
</tr> </tr>
@ -222,19 +211,19 @@ if (isset($updated)) { ?>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('ICQ:') ?></th> <th scope="row"><?php _e('ICQ:') ?></th>
<td><input type="text" name="newuser_icq" id="newuser_icq2" value="<?php if ($profiledata->user_icq > 0) { echo $profiledata->user_icq; } ?>" /></td> <td><input type="text" name="newuser_icq" id="newuser_icq2" value="<?php if ($profiledata->icq > 0) { echo $profiledata->icq; } ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('AIM:') ?></th> <th scope="row"><?php _e('AIM:') ?></th>
<td><input type="text" name="newuser_aim" id="newuser_aim2" value="<?php echo $profiledata->user_aim ?>" /></td> <td><input type="text" name="newuser_aim" id="newuser_aim2" value="<?php echo $profiledata->aim ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('MSN IM:') ?> </th> <th scope="row"><?php _e('MSN IM:') ?> </th>
<td><input type="text" name="newuser_msn" id="newuser_msn2" value="<?php echo $profiledata->user_msn ?>" /></td> <td><input type="text" name="newuser_msn" id="newuser_msn2" value="<?php echo $profiledata->msn ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Yahoo IM:') ?> </th> <th scope="row"><?php _e('Yahoo IM:') ?> </th>
<td> <input type="text" name="newuser_yim" id="newuser_yim2" value="<?php echo $profiledata->user_yim ?>" /> </td> <td> <input type="text" name="newuser_yim" id="newuser_yim2" value="<?php echo $profiledata->yim ?>" /> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Profile:') ?></th> <th scope="row"><?php _e('Profile:') ?></th>

View File

@ -125,25 +125,13 @@ CREATE TABLE $wpdb->users (
ID bigint(20) unsigned NOT NULL auto_increment, ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '', user_login varchar(60) NOT NULL default '',
user_pass varchar(64) NOT NULL default '', user_pass varchar(64) NOT NULL default '',
user_firstname varchar(50) NOT NULL default '',
user_lastname varchar(50) NOT NULL default '',
user_nickname varchar(50) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '', user_nicename varchar(50) NOT NULL default '',
user_icq int(10) unsigned NOT NULL default '0',
user_email varchar(100) NOT NULL default '', user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '', user_url varchar(100) NOT NULL default '',
user_ip varchar(15) NOT NULL default '',
user_domain varchar(200) NOT NULL default '',
user_browser varchar(200) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00', user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_level int(2) unsigned NOT NULL default '0', user_level int(2) unsigned NOT NULL default '0',
user_aim varchar(50) NOT NULL default '',
user_msn varchar(100) NOT NULL default '',
user_yim varchar(50) NOT NULL default '',
user_idmode varchar(20) NOT NULL default '',
user_activation_key varchar(60) NOT NULL default '', user_activation_key varchar(60) NOT NULL default '',
user_status int(11) NOT NULL default '0', user_status int(11) NOT NULL default '0',
user_description longtext NOT NULL default '',
display_name varchar(250) NOT NULL default '', display_name varchar(250) NOT NULL default '',
PRIMARY KEY (ID), PRIMARY KEY (ID),
UNIQUE KEY user_login (user_login) UNIQUE KEY user_login (user_login)

View File

@ -63,19 +63,19 @@ $new_yim = wp_specialchars($_POST['new_yim']);
$new_email = wp_specialchars($_POST['new_email']); $new_email = wp_specialchars($_POST['new_email']);
$new_url = wp_specialchars($_POST['new_url']); $new_url = wp_specialchars($_POST['new_url']);
$new_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $new_url) ? $new_url : 'http://' . $new_url; $new_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $new_url) ? $new_url : 'http://' . $new_url;
$new_idmode = wp_specialchars($_POST['new_idmode']); $display_name = wp_specialchars($_POST['display_name']);
$new_description = $_POST['new_description']; $new_description = $_POST['new_description'];
$result = $wpdb->query("UPDATE $wpdb->users SET user_login = '$new_user_login', $updatepassword user_email='$new_email', user_url='$new_url', user_nicename = '$new_nicename' WHERE ID = '$user_id'"); $result = $wpdb->query("UPDATE $wpdb->users SET user_login = '$new_user_login', $updatepassword user_email='$new_email', user_url='$new_url', user_nicename = '$new_nicename', display_name = '$display_name' WHERE ID = '$user_id'");
update_user_meta( $user_ID, 'first_name', $new_firstname ); update_usermeta( $user_ID, 'first_name', $new_firstname );
update_user_meta( $user_ID, 'last_name', $new_lastname ); update_usermeta( $user_ID, 'last_name', $new_lastname );
update_user_meta( $user_ID, 'nickname', $new_nickname ); update_usermeta( $user_ID, 'nickname', $new_nickname );
update_user_meta( $user_ID, 'description', $new_description ); update_usermeta( $user_ID, 'description', $new_description );
update_user_meta( $user_ID, 'icq', $new_icq ); update_usermeta( $user_ID, 'icq', $new_icq );
update_user_meta( $user_ID, 'aim', $new_aim ); update_usermeta( $user_ID, 'aim', $new_aim );
update_user_meta( $user_ID, 'msn', $new_msn ); update_usermeta( $user_ID, 'msn', $new_msn );
update_user_meta( $user_ID, 'yim', $new_yim ); update_usermeta( $user_ID, 'yim', $new_yim );
header("Location: user-edit.php?user_id=$user_id&updated=true"); header("Location: user-edit.php?user_id=$user_id&updated=true");
@ -127,11 +127,11 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to
<?php } ?> <?php } ?>
<tr> <tr>
<th scope="row"><?php _e('First name:') ?></th> <th scope="row"><?php _e('First name:') ?></th>
<td><input type="text" name="new_firstname" id="new_firstname" value="<?php echo $edituser->user_firstname ?>" /></td> <td><input type="text" name="new_firstname" id="new_firstname" value="<?php echo $edituser->first_name ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Last name:') ?></th> <th scope="row"><?php _e('Last name:') ?></th>
<td><input type="text" name="new_lastname" id="new_lastname2" value="<?php echo $edituser->user_lastname ?>" /></td> <td><input type="text" name="new_lastname" id="new_lastname2" value="<?php echo $edituser->last_name ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Profile:') ?></th> <th scope="row"><?php _e('Profile:') ?></th>
@ -139,7 +139,7 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Nickname:') ?></th> <th scope="row"><?php _e('Nickname:') ?></th>
<td><input type="text" name="new_nickname" id="new_nickname" value="<?php echo $edituser->user_nickname ?>" /></td> <td><input type="text" name="new_nickname" id="new_nickname" value="<?php echo $edituser->nickname ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('E-mail:') ?></th> <th scope="row"><?php _e('E-mail:') ?></th>
@ -151,45 +151,40 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('ICQ:') ?></th> <th scope="row"><?php _e('ICQ:') ?></th>
<td><input type="text" name="new_icq" id="new_icq" value="<?php if ($edituser->user_icq > 0) { echo $edituser->user_icq; } ?>" /></td> <td><input type="text" name="new_icq" id="new_icq" value="<?php if ($edituser->icq > 0) { echo $edituser->icq; } ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('AIM:') ?></th> <th scope="row"><?php _e('AIM:') ?></th>
<td><input type="text" name="new_aim" id="new_aim" value="<?php echo $edituser->user_aim ?>" /></td> <td><input type="text" name="new_aim" id="new_aim" value="<?php echo $edituser->aim ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('MSN IM:') ?> <th scope="row"><?php _e('MSN IM:') ?>
</th> </th>
<td><input type="text" name="new_msn" id="new_msn" value="<?php echo $edituser->user_msn ?>" /></td> <td><input type="text" name="new_msn" id="new_msn" value="<?php echo $edituser->msn ?>" /></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Yahoo IM:') ?> <th scope="row"><?php _e('Yahoo IM:') ?>
</th> </th>
<td><input type="text" name="new_yim" id="new_yim" value="<?php echo $edituser->user_yim ?>" /> <td><input type="text" name="new_yim" id="new_yim" value="<?php echo $edituser->yim ?>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php _e('Identity on blog:') ?> <th scope="row"><?php _e('Identity on blog:') ?>
</th> </th>
<td><select name="new_idmode"> <td> <select name="display_name">
<option value="nickname"<?php <option value="<?php echo $profiledata->display_name; ?>"><?php echo $profiledata->display_name; ?></option>
if ($edituser->user_idmode == 'nickname') <option value="<?php echo $profiledata->nickname ?>"><?php echo $profiledata->nickname ?></option>
echo ' selected="selected"'; ?>><?php echo $edituser->user_nickname ?></option> <option value="<?php echo $profiledata->user_login ?>"><?php echo $profiledata->user_login ?></option>
<option value="login"<?php <?php if ( !empty( $profiledata->first_name ) ) : ?>
if ($edituser->user_idmode=="login") <option value="<?php echo $profiledata->first_name ?>"><?php echo $profiledata->first_name ?></option>
echo ' selected="selected"'; ?>><?php echo $edituser->user_login ?></option> <?php endif; ?>
<option value="firstname"<?php <?php if ( !empty( $profiledata->last_name ) ) : ?>
if ($edituser->user_idmode=="firstname") <option value="<?php echo $profiledata->last_name ?>"><?php echo $profiledata->last_name ?></option>
echo ' selected="selected"'; ?>><?php echo $edituser->user_firstname ?></option> <?php endif; ?>
<option value="lastname"<?php <?php if ( !empty( $profiledata->first_name ) && !empty( $profiledata->last_name ) ) : ?>
if ($edituser->user_idmode=="lastname") <option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
echo ' selected="selected"'; ?>><?php echo $edituser->user_lastname ?></option> <option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
<option value="namefl"<?php <?php endif; ?>
if ($edituser->user_idmode=="namefl")
echo ' selected="selected"'; ?>><?php echo $edituser->user_firstname." ".$edituser->user_lastname ?></option>
<option value="namelf"<?php
if ($edituser->user_idmode=="namelf")
echo ' selected="selected"'; ?>><?php echo $edituser->user_lastname." ".$edituser->user_firstname ?></option>
</select> </select>
</td> </td>
</tr> </tr>

View File

@ -197,8 +197,8 @@ default:
echo " echo "
<tr $style> <tr $style>
<td align='center'>$user_data->ID</td> <td align='center'>$user_data->ID</td>
<td><strong>$user_data->user_nickname</strong></td> <td><strong>$user_data->user_login</strong></td>
<td>$user_data->user_firstname $user_data->user_lastname</td> <td>$user_data->first_name $user_data->last_name</td>
<td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td> <td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
<td><a href='$url' title='website: $url'>$short_url</a></td> <td><a href='$url' title='website: $url'>$short_url</a></td>
<td align='center'>"; <td align='center'>";
@ -252,8 +252,8 @@ foreach ($users as $user) {
$style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
echo "\n<tr $style> echo "\n<tr $style>
<td align='center'>$user_data->ID</td> <td align='center'>$user_data->ID</td>
<td><strong>$user_data->user_nickname</strong></td> <td><strong>$user_data->user_login</strong></td>
<td>$user_data->user_firstname $user_data->user_lastname</td> <td>$user_data->first_name $user_data->last_name</td>
<td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td> <td><a href='mailto:$email' title='" . sprintf(__('e-mail: %s'), $email) . "'>$email</a></td>
<td><a href='$url' title='website: $url'>$short_url</a></td> <td><a href='$url' title='website: $url'>$short_url</a></td>
<td align='center'>"; <td align='center'>";

View File

@ -1164,9 +1164,13 @@ function update_category_cache() {
function update_user_cache() { function update_user_cache() {
global $cache_userdata, $wpdb; global $cache_userdata, $wpdb;
$query = apply_filters('user_cache_query', "SELECT * FROM $wpdb->users WHERE user_level > 0");
if ( $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level > 0") ) : if ( $users = $wpdb->get_results( $query ) ) :
foreach ($users as $user) : foreach ($users as $user) :
$metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user->ID'");
foreach ( $metavalues as $meta )
$user->{$meta->meta_key} = $meta->meta_value;
$cache_userdata[$user->ID] = $user; $cache_userdata[$user->ID] = $user;
$cache_userdata[$user->user_login] =& $cache_userdata[$user->ID]; $cache_userdata[$user->user_login] =& $cache_userdata[$user->ID];
endforeach; endforeach;
@ -1280,7 +1284,7 @@ function is_author ($author = '') {
if ($author == $author_obj->ID) { if ($author == $author_obj->ID) {
return true; return true;
} else if ($author == $author_obj->user_nickname) { } else if ($author == $author_obj->nickname) {
return true; return true;
} else if ($author == $author_obj->user_nicename) { } else if ($author == $author_obj->user_nicename) {
return true; return true;

View File

@ -43,6 +43,8 @@ function get_userdata( $user_id ) {
foreach ( $metavalues as $meta ) foreach ( $metavalues as $meta )
$user->{$meta->meta_key} = $meta->meta_value; $user->{$meta->meta_key} = $meta->meta_value;
$cache_userdata[$user_id] = $user;
$cache_userdata[$cache_userdata[$userid]->user_login] =& $cache_userdata[$user_id]; $cache_userdata[$cache_userdata[$userid]->user_login] =& $cache_userdata[$user_id];
return $cache_userdata[$user_id]; return $cache_userdata[$user_id];

View File

@ -26,21 +26,21 @@ function the_author_login() {
} }
function get_the_author_firstname() { function get_the_author_firstname() {
global $id,$authordata; return $authordata->user_firstname; global $id,$authordata; return $authordata->first_name;
} }
function the_author_firstname() { function the_author_firstname() {
echo get_the_author_firstname(); echo get_the_author_firstname();
} }
function get_the_author_lastname() { function get_the_author_lastname() {
global $id,$authordata; return $authordata->user_lastname; global $id,$authordata; return $authordata->last_name;
} }
function the_author_lastname() { function the_author_lastname() {
echo get_the_author_lastname(); echo get_the_author_lastname();
} }
function get_the_author_nickname() { function get_the_author_nickname() {
global $id,$authordata; return $authordata->user_nickname; global $id,$authordata; return $authordata->nickname;
} }
function the_author_nickname() { function the_author_nickname() {
echo get_the_author_nickname(); echo get_the_author_nickname();
@ -70,35 +70,37 @@ function the_author_url() {
} }
function get_the_author_icq() { function get_the_author_icq() {
global $id,$authordata; return $authordata->user_icq; global $id,$authordata; return $authordata->icq;
} }
function the_author_icq() { function the_author_icq() {
echo get_the_author_icq(); echo get_the_author_icq();
} }
function get_the_author_aim() { function get_the_author_aim() {
global $id,$authordata; return str_replace(' ', '+', $authordata->user_aim); global $id,$authordata; return str_replace(' ', '+', $authordata->aim);
} }
function the_author_aim() { function the_author_aim() {
echo get_the_author_aim(); echo get_the_author_aim();
} }
function get_the_author_yim() { function get_the_author_yim() {
global $id,$authordata; return $authordata->user_yim; global $id,$authordata; return $authordata->yim;
} }
function the_author_yim() { function the_author_yim() {
echo get_the_author_yim(); echo get_the_author_yim();
} }
function get_the_author_msn() { function get_the_author_msn() {
global $id,$authordata; return $authordata->user_msn; global $id,$authordata; return $authordata->msn;
} }
function the_author_msn() { function the_author_msn() {
echo get_the_author_msn(); echo get_the_author_msn();
} }
function get_the_author_posts() { function get_the_author_posts() {
global $id,$post; $posts=get_usernumposts($post->post_author); return $posts; global $id,$post;
$posts=get_usernumposts($post->post_author);
return $posts;
} }
function the_author_posts() { function the_author_posts() {
echo get_the_author_posts(); echo get_the_author_posts();
@ -152,10 +154,10 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
foreach($authors as $author) { foreach($authors as $author) {
$author = get_userdata( $author->ID ); $author = get_userdata( $author->ID );
$posts = get_usernumposts($author->ID); $posts = get_usernumposts($author->ID);
$name = $author->user_nickname; $name = $author->nickname;
if ($show_fullname && ($author->user_firstname != '' && $author->user_lastname != '')) { if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) {
$name = "$author->user_firstname $author->user_lastname"; $name = "$author->first_name $author->last_name";
} }
if (! ($posts == 0 && $hide_empty)) echo "<li>"; if (! ($posts == 0 && $hide_empty)) echo "<li>";
@ -163,7 +165,7 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam
if ( !$hide_empty ) if ( !$hide_empty )
$link = $name; $link = $name;
} else { } else {
$link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->user_nickname)) . '">' . $name . '</a>'; $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) { if ( (! empty($feed_image)) || (! empty($feed)) ) {

View File

@ -42,21 +42,16 @@ case 'register':
if ( $result = $wpdb->get_row("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'") ) if ( $result = $wpdb->get_row("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'") )
die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.')); die (__('<strong>ERROR</strong>: This username is already registered, please choose another one.'));
$user_ip = $_SERVER['REMOTE_ADDR'] ;
$user_browser = $wpdb->escape($_SERVER['HTTP_USER_AGENT']);
$user_login = $wpdb->escape( sanitize_user($user_login) ) ); $user_login = $wpdb->escape( sanitize_user($user_login) ) );
$user_nickname = $user_login;
$user_nicename = sanitize_title($user_nickname); $user_nicename = sanitize_title($user_nickname);
$now = gmdate('Y-m-d H:i:s'); $now = gmdate('Y-m-d H:i:s');
$user_level = get_settings('new_users_can_blog'); $user_level = get_settings('new_users_can_blog');
$password = substr( md5( uniqid( microtime() ) ), 0, 7); $password = substr( md5( uniqid( microtime() ) ), 0, 7);
$result = $wpdb->query("INSERT INTO $wpdb->users $result = $wpdb->query("INSERT INTO $wpdb->users
(user_login, user_pass, user_nickname, user_email, user_ip, user_browser, user_registered, user_level, user_idmode, user_nicename) (user_login, user_pass, user_email, user_registered, user_level, user_nicename)
VALUES VALUES
('$user_login', MD5('$password'), '$user_nickname', '$user_email', '$user_ip', '$user_browser', '$now', '$user_level', 'nickname', '$user_nicename')"); ('$user_login', MD5('$password'), '$user_email', '$now', '$user_level', '$user_nicename')");
do_action('user_register', $wpdb->insert_id); do_action('user_register', $wpdb->insert_id);

View File

@ -172,12 +172,12 @@ class wp_xmlrpc_server extends IXR_Server {
$user_data = get_userdatabylogin($user_login); $user_data = get_userdatabylogin($user_login);
$struct = array( $struct = array(
'nickname' => $user_data->user_nickname, 'nickname' => $user_data->nickname,
'userid' => $user_data->ID, 'userid' => $user_data->ID,
'url' => $user_data->user_url, 'url' => $user_data->user_url,
'email' => $user_data->user_email, 'email' => $user_data->user_email,
'lastname' => $user_data->user_lastname, 'lastname' => $user_data->last_name,
'firstname' => $user_data->user_firstname 'firstname' => $user_data->first_name
); );
return $struct; return $struct;