diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 3a215eaf49..edbba832e3 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -150,16 +150,17 @@ if ('publish' != $post_status || 0 == $post_ID) { : - 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") ) : ?> + 7 && $users = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?> : diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index cdce8d6338..38d9f27c80 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -108,16 +108,17 @@ edCanvas = document.getElementById('content'); : - 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") ) : ?> + 7 && $users = $wpdb->get_results("SELECT ID, user_login FROM $wpdb->users WHERE user_level <= $user_level AND user_level > 0") ) : ?> : diff --git a/wp-admin/import-blogger.php b/wp-admin/import-blogger.php index c2ca831360..928fdabf15 100644 --- a/wp-admin/import-blogger.php +++ b/wp-admin/import-blogger.php @@ -66,13 +66,9 @@ case "step1": // we'll check the author is registered already $user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"); 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_login = addslashes($post_author); $pass1 = addslashes('password'); - $user_nickname = addslashes($post_author); $user_email = addslashes('user@wordpress.org'); $user_url = addslashes(''); $user_joindate = addslashes($user_joindate); @@ -80,27 +76,17 @@ case "step1": 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' )"); echo ": Registered user $user_login"; diff --git a/wp-admin/import-greymatter.php b/wp-admin/import-greymatter.php index 497d7b48ea..fa743afb93 100644 --- a/wp-admin/import-greymatter.php +++ b/wp-admin/import-greymatter.php @@ -87,10 +87,6 @@ case "step1": foreach($userbase as $user) { $userdata=explode("|", $user); - $user_ip="127.0.0.1"; - $user_domain="localhost"; - $user_browser="server"; - $s=$userdata[4]; $user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00"; @@ -107,7 +103,7 @@ case "step1": 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); if ($result==false) { die ("ERROR: couldn't register an user!"); @@ -156,9 +152,6 @@ case "step1": $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'"; $result = $wpdb->query($sql); 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_login=addslashes($post_author); $pass1=addslashes("password"); @@ -166,7 +159,7 @@ case "step1": $user_email=addslashes("user@deleted.com"); $user_url=addslashes(""); $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); if ($result==false) { die ("ERROR: couldn't register an user!"); diff --git a/wp-admin/profile.php b/wp-admin/profile.php index 69495a5333..9504f6e32d 100644 --- a/wp-admin/profile.php +++ b/wp-admin/profile.php @@ -72,6 +72,7 @@ case 'update': $newuser_firstname = wp_specialchars($_POST['newuser_firstname']); $newuser_lastname = wp_specialchars($_POST['newuser_lastname']); + $new_display_name = wp_specialchars($_POST['display_name']); $newuser_nickname = $_POST['newuser_nickname']; $newuser_nicename = sanitize_title($newuser_nickname); $newuser_icq = wp_specialchars($_POST['newuser_icq']); @@ -81,19 +82,18 @@ case 'update': $newuser_email = wp_specialchars($_POST['newuser_email']); $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_idmode = wp_specialchars($_POST['newuser_idmode']); $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_user_meta( $user_ID, 'last_name', $newuser_lastname ); - update_user_meta( $user_ID, 'nickname', $newuser_nickname ); - update_user_meta( $user_ID, 'description', $user_description ); - update_user_meta( $user_ID, 'icq', $newuser_icq ); - update_user_meta( $user_ID, 'aim', $newuser_aim ); - update_user_meta( $user_ID, 'msn', $newuser_msn ); - update_user_meta( $user_ID, 'yim', $newuser_yim ); + update_usermeta( $user_ID, 'first_name', $newuser_firstname ); + update_usermeta( $user_ID, 'last_name', $newuser_lastname ); + update_usermeta( $user_ID, 'nickname', $newuser_nickname ); + update_usermeta( $user_ID, 'description', $user_description ); + update_usermeta( $user_ID, 'icq', $newuser_icq ); + update_usermeta( $user_ID, 'aim', $newuser_aim ); + update_usermeta( $user_ID, 'msn', $newuser_msn ); + update_usermeta( $user_ID, 'yim', $newuser_yim ); do_action('profile_update', $user_ID); @@ -136,10 +136,11 @@ break; default: $parent_file = 'profile.php'; include_once('admin-header.php'); - $profiledata=get_userdata($user_ID); + $profiledata = get_userdata($user_ID); $bookmarklet_height= 440; +var_dump( $profiledata ); if (isset($updated)) { ?>

@@ -171,44 +172,32 @@ if (isset($updated)) { ?> - + - + - + - + + + + first_name ) ) : ?> + - user_lastname ) ) : ?> - + last_name ) ) : ?> + - user_firstname ) && !empty( $profiledata->user_lastname ) ) : ?> - - - user_firstname ) && !empty( $profiledata->user_lastname ) ) : ?> - + first_name ) && !empty( $profiledata->last_name ) ) : ?> + + @@ -222,19 +211,19 @@ if (isset($updated)) { ?> - + - + - + - + diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index cc9cd8dc7e..9ee0713944 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -125,25 +125,13 @@ CREATE TABLE $wpdb->users ( ID bigint(20) unsigned NOT NULL auto_increment, user_login varchar(60) 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_icq int(10) unsigned NOT NULL default '0', user_email 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_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_status int(11) NOT NULL default '0', - user_description longtext NOT NULL default '', display_name varchar(250) NOT NULL default '', PRIMARY KEY (ID), UNIQUE KEY user_login (user_login) diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index f6a63bf073..c70f3366b9 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -63,19 +63,19 @@ $new_yim = wp_specialchars($_POST['new_yim']); $new_email = wp_specialchars($_POST['new_email']); $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_idmode = wp_specialchars($_POST['new_idmode']); +$display_name = wp_specialchars($_POST['display_name']); $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_user_meta( $user_ID, 'last_name', $new_lastname ); -update_user_meta( $user_ID, 'nickname', $new_nickname ); -update_user_meta( $user_ID, 'description', $new_description ); -update_user_meta( $user_ID, 'icq', $new_icq ); -update_user_meta( $user_ID, 'aim', $new_aim ); -update_user_meta( $user_ID, 'msn', $new_msn ); -update_user_meta( $user_ID, 'yim', $new_yim ); +update_usermeta( $user_ID, 'first_name', $new_firstname ); +update_usermeta( $user_ID, 'last_name', $new_lastname ); +update_usermeta( $user_ID, 'nickname', $new_nickname ); +update_usermeta( $user_ID, 'description', $new_description ); +update_usermeta( $user_ID, 'icq', $new_icq ); +update_usermeta( $user_ID, 'aim', $new_aim ); +update_usermeta( $user_ID, 'msn', $new_msn ); +update_usermeta( $user_ID, 'yim', $new_yim ); 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 - + - + @@ -139,7 +139,7 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to - + @@ -151,46 +151,41 @@ if ($edituser->user_level >= $user_level) die( __('You do not have permission to - + - + - + - + - + $user_data->ID - $user_data->user_nickname - $user_data->user_firstname $user_data->user_lastname + $user_data->user_login + $user_data->first_name $user_data->last_name $email $short_url "; @@ -252,8 +252,8 @@ foreach ($users as $user) { $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; echo "\n $user_data->ID -$user_data->user_nickname -$user_data->user_firstname $user_data->user_lastname +$user_data->user_login +$user_data->first_name $user_data->last_name $email $short_url "; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index db7f65bccf..e677fded76 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1164,9 +1164,13 @@ function update_category_cache() { function update_user_cache() { global $cache_userdata, $wpdb; - - if ( $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level > 0") ) : + $query = apply_filters('user_cache_query', "SELECT * FROM $wpdb->users WHERE user_level > 0"); + if ( $users = $wpdb->get_results( $query ) ) : 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->user_login] =& $cache_userdata[$user->ID]; endforeach; @@ -1280,7 +1284,7 @@ function is_author ($author = '') { if ($author == $author_obj->ID) { return true; - } else if ($author == $author_obj->user_nickname) { + } else if ($author == $author_obj->nickname) { return true; } else if ($author == $author_obj->user_nicename) { return true; diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index 53aef2c7ab..7aad5fc0c1 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -43,6 +43,8 @@ function get_userdata( $user_id ) { foreach ( $metavalues as $meta ) $user->{$meta->meta_key} = $meta->meta_value; + $cache_userdata[$user_id] = $user; + $cache_userdata[$cache_userdata[$userid]->user_login] =& $cache_userdata[$user_id]; return $cache_userdata[$user_id]; diff --git a/wp-includes/template-functions-author.php b/wp-includes/template-functions-author.php index 791f75d63b..3cb938d6ad 100644 --- a/wp-includes/template-functions-author.php +++ b/wp-includes/template-functions-author.php @@ -26,21 +26,21 @@ function the_author_login() { } function get_the_author_firstname() { - global $id,$authordata; return $authordata->user_firstname; + global $id,$authordata; return $authordata->first_name; } function the_author_firstname() { echo get_the_author_firstname(); } function get_the_author_lastname() { - global $id,$authordata; return $authordata->user_lastname; + global $id,$authordata; return $authordata->last_name; } function the_author_lastname() { echo get_the_author_lastname(); } function get_the_author_nickname() { - global $id,$authordata; return $authordata->user_nickname; + global $id,$authordata; return $authordata->nickname; } function the_author_nickname() { echo get_the_author_nickname(); @@ -70,35 +70,37 @@ function the_author_url() { } function get_the_author_icq() { - global $id,$authordata; return $authordata->user_icq; + global $id,$authordata; return $authordata->icq; } function the_author_icq() { echo get_the_author_icq(); } 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() { echo get_the_author_aim(); } function get_the_author_yim() { - global $id,$authordata; return $authordata->user_yim; + global $id,$authordata; return $authordata->yim; } function the_author_yim() { echo get_the_author_yim(); } function get_the_author_msn() { - global $id,$authordata; return $authordata->user_msn; + global $id,$authordata; return $authordata->msn; } function the_author_msn() { echo get_the_author_msn(); } 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() { echo get_the_author_posts(); @@ -152,10 +154,10 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam foreach($authors as $author) { $author = get_userdata( $author->ID ); $posts = get_usernumposts($author->ID); - $name = $author->user_nickname; + $name = $author->nickname; - if ($show_fullname && ($author->user_firstname != '' && $author->user_lastname != '')) { - $name = "$author->user_firstname $author->user_lastname"; + if ($show_fullname && ($author->first_name != '' && $author->last_name != '')) { + $name = "$author->first_name $author->last_name"; } if (! ($posts == 0 && $hide_empty)) echo "
  • "; @@ -163,7 +165,7 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam if ( !$hide_empty ) $link = $name; } else { - $link = 'user_nickname)) . '">' . $name . ''; + $link = 'display_name)) . '">' . $name . ''; if ( (! empty($feed_image)) || (! empty($feed)) ) { diff --git a/wp-register.php b/wp-register.php index b84ca36c00..3a2d69e5fb 100644 --- a/wp-register.php +++ b/wp-register.php @@ -42,21 +42,16 @@ case 'register': if ( $result = $wpdb->get_row("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'") ) die (__('ERROR: 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_nickname = $user_login; $user_nicename = sanitize_title($user_nickname); $now = gmdate('Y-m-d H:i:s'); $user_level = get_settings('new_users_can_blog'); $password = substr( md5( uniqid( microtime() ) ), 0, 7); $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 - ('$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); diff --git a/xmlrpc.php b/xmlrpc.php index dd4c8e4453..47544f639c 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -172,12 +172,12 @@ class wp_xmlrpc_server extends IXR_Server { $user_data = get_userdatabylogin($user_login); $struct = array( - 'nickname' => $user_data->user_nickname, + 'nickname' => $user_data->nickname, 'userid' => $user_data->ID, 'url' => $user_data->user_url, 'email' => $user_data->user_email, - 'lastname' => $user_data->user_lastname, - 'firstname' => $user_data->user_firstname + 'lastname' => $user_data->last_name, + 'firstname' => $user_data->first_name ); return $struct;