Changeset 21413
- Timestamp:
- 08/03/2012 01:06:05 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-activate.php
r19593 r21413 78 78 extract($result); 79 79 $url = get_blogaddress_by_id( (int) $blog_id); 80 $user = new WP_User( (int) $user_id);80 $user = get_userdata( (int) $user_id); 81 81 ?> 82 82 <h2><?php _e('Your account is now active!'); ?></h2> -
trunk/wp-admin/includes/ajax-actions.php
r21203 r21413 1019 1019 $x->send(); 1020 1020 } 1021 $user_object = new WP_User( $user_id );1021 $user_object = get_userdata( $user_id ); 1022 1022 1023 1023 $wp_list_table = _get_list_table('WP_Users_List_Table'); -
trunk/wp-admin/includes/class-wp-users-list-table.php
r21364 r21413 219 219 220 220 if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) ) 221 $user_object = new WP_User( (int) $user_object );221 $user_object = get_userdata( (int) $user_object ); 222 222 $user_object->filter = 'display'; 223 223 $email = $user_object->user_email; -
trunk/wp-admin/includes/deprecated.php
r21353 r21413 250 250 global $wpdb; 251 251 252 $user = new WP_User( $user_id ); 252 if ( ! $user = get_userdata( $user_id ) ) 253 return array(); 253 254 $post_type_obj = get_post_type_object($post_type); 254 255 -
trunk/wp-admin/includes/ms.php
r21387 r21413 690 690 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 691 691 692 $user = new WP_User( $user_id );693 if ( ! in_array( $user->user_login, $super_admins ) ) {692 $user = get_userdata( $user_id ); 693 if ( $user && ! in_array( $user->user_login, $super_admins ) ) { 694 694 $super_admins[] = $user->user_login; 695 695 update_site_option( 'site_admins' , $super_admins ); … … 718 718 $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); 719 719 720 $user = new WP_User( $user_id );721 if ( $user ->user_email != get_site_option( 'admin_email' ) ) {720 $user = get_userdata( $user_id ); 721 if ( $user && $user->user_email != get_site_option( 'admin_email' ) ) { 722 722 if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) { 723 723 unset( $super_admins[$key] ); -
trunk/wp-admin/includes/upgrade.php
r21333 r21413 321 321 */ 322 322 function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) { 323 $user = new WP_User( $user_id);323 $user = new WP_User( $user_id ); 324 324 $email = $user->user_email; 325 325 $name = $user->user_login; -
trunk/wp-admin/includes/user.php
r21364 r21413 199 199 */ 200 200 function get_user_to_edit( $user_id ) { 201 $user = new WP_User( $user_id );201 $user = get_userdata( $user_id ); 202 202 203 203 $user->filter = 'edit'; -
trunk/wp-admin/network/site-users.php
r21003 r21413 144 144 wp_die(__('Cheatin’ uh?')); 145 145 146 $user = new WP_User( $user_id );146 $user = get_userdata( $user_id ); 147 147 $user->set_role( $_REQUEST['new_role'] ); 148 148 } -
trunk/wp-admin/network/users.php
r21003 r21413 35 35 foreach ( ( $allusers = (array) $_POST['allusers'] ) as $key => $val ) { 36 36 if ( $val != '' && $val != '0' ) { 37 $delete_user = new WP_User( $val );37 $delete_user = get_userdata( $val ); 38 38 39 39 if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) … … 140 140 141 141 case 'spam': 142 $user = new WP_User( $val );143 if ( i n_array( $user->user_login, get_super_admins()) )142 $user = get_userdata( $val ); 143 if ( is_super_admin( $user->ID ) ) 144 144 wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); 145 145 -
trunk/wp-admin/users.php
r21003 r21413 112 112 wp_die(__('Cheatin’ uh?')); 113 113 114 $user = new WP_User($id);114 $user = get_userdata( $id ); 115 115 $user->set_role($_REQUEST['new_role']); 116 116 } … … 202 202 foreach ( $userids as $id ) { 203 203 $id = (int) $id; 204 $user = new WP_User($id);204 $user = get_userdata( $id ); 205 205 if ( $id == $current_user->ID ) { 206 206 echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n"; … … 303 303 foreach ( $userids as $id ) { 304 304 $id = (int) $id; 305 $user = new WP_User($id);305 $user = get_userdata( $id ); 306 306 if ( $id == $current_user->ID && !is_super_admin() ) { 307 307 echo "<li>" . sprintf(__('ID #%1s: %2s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n"; -
trunk/wp-includes/capabilities.php
r21377 r21413 1238 1238 1239 1239 // Create new object to avoid stomping the global current_user. 1240 $user = new WP_User( $current_user->ID );1240 $user = new WP_User( $current_user->ID ); 1241 1241 1242 1242 // Set the blog id. @todo add blog id arg to WP_User constructor? … … 1262 1262 return false; 1263 1263 1264 $author = new WP_User( $post->post_author );1265 1266 if ( empty( $author->ID ))1264 $author = get_userdata( $post->post_author ); 1265 1266 if ( ! $author ) 1267 1267 return false; 1268 1268 … … 1284 1284 function user_can( $user, $capability ) { 1285 1285 if ( ! is_object( $user ) ) 1286 $user = new WP_User( $user );1286 $user = get_userdata( $user ); 1287 1287 1288 1288 if ( ! $user || ! $user->exists() ) -
trunk/wp-includes/comment.php
r21186 r21413 651 651 do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt ); 652 652 653 if ( isset($user_id) && $user_id) { 654 $userdata = get_userdata($user_id); 655 $user = new WP_User($user_id); 653 if ( ! empty( $user_id ) ) { 654 $user = get_userdata( $user_id ); 656 655 $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID)); 657 656 } 658 657 659 if ( isset($userdata)&& ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {658 if ( $user && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) { 660 659 // The author and the admins get respect. 661 660 $approved = 1; -
trunk/wp-includes/link-template.php
r21364 r21413 1072 1072 return ''; 1073 1073 1074 $user = new WP_User( $user_id );1075 1076 if ( ! $user ->exists())1074 $user = get_userdata( $user_id ); 1075 1076 if ( ! $user ) 1077 1077 return ''; 1078 1078 -
trunk/wp-includes/ms-functions.php
r21387 r21413 184 184 switch_to_blog($blog_id); 185 185 186 $user = new WP_User($user_id);187 188 if ( ! $user ->exists()) {186 $user = get_userdata( $user_id ); 187 188 if ( ! $user ) { 189 189 restore_current_blog(); 190 190 return new WP_Error('user_does_not_exist', __('That user does not exist.')); … … 247 247 248 248 // wp_revoke_user($user_id); 249 $user = new WP_User($user_id);250 if ( ! $user ->exists()) {249 $user = get_userdata( $user_id ); 250 if ( ! $user ) { 251 251 restore_current_blog(); 252 252 return new WP_Error('user_does_not_exist', __('That user does not exist.')); … … 1057 1057 return false; 1058 1058 1059 $user = new WP_User($user_id);1059 $user = get_userdata( $user_id ); 1060 1060 1061 1061 $options_site_url = esc_url(network_admin_url('settings.php')); … … 1234 1234 1235 1235 $url = get_blogaddress_by_id($blog_id); 1236 $user = new WP_User($user_id);1236 $user = get_userdata( $user_id ); 1237 1237 1238 1238 $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email ); … … 1283 1283 $welcome_email = get_site_option( 'welcome_user_email' ); 1284 1284 1285 $user = new WP_User($user_id);1285 $user = get_userdata( $user_id ); 1286 1286 1287 1287 $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta); … … 1509 1509 function wpmu_log_new_registrations( $blog_id, $user_id ) { 1510 1510 global $wpdb; 1511 $user = new WP_User( (int) $user_id );1511 $user = get_userdata( (int) $user_id ); 1512 1512 $wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '',$_SERVER['REMOTE_ADDR'] ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) ); 1513 1513 } … … 1752 1752 $user_id = get_user_id_from_string( $username ); 1753 1753 } 1754 $u = new WP_User( $user_id );1754 $u = get_userdata( $user_id ); 1755 1755 1756 1756 return ( isset( $u->spam ) && $u->spam == 1 ); -
trunk/wp-includes/pluggable.php
r21376 r21413 1199 1199 */ 1200 1200 function wp_new_user_notification($user_id, $plaintext_pass = '') { 1201 $user = new WP_User($user_id);1201 $user = get_userdata( $user_id ); 1202 1202 1203 1203 $user_login = stripslashes($user->user_login); -
trunk/wp-includes/user.php
r21374 r21413 85 85 } 86 86 87 $user data= get_user_by('login', $username);88 89 if ( !$user data)87 $user = get_user_by('login', $username); 88 89 if ( !$user ) 90 90 return new WP_Error('invalid_username', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), wp_lostpassword_url())); 91 91 92 92 if ( is_multisite() ) { 93 93 // Is user marked as spam? 94 if ( 1 == $user data->spam)94 if ( 1 == $user->spam) 95 95 return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Your account has been marked as a spammer.')); 96 96 97 97 // Is a user's blog marked as spam? 98 if ( !is_super_admin( $user data->ID ) && isset($userdata->primary_blog) ) {99 $details = get_blog_details( $user data->primary_blog );98 if ( !is_super_admin( $user->ID ) && isset($user->primary_blog) ) { 99 $details = get_blog_details( $user->primary_blog ); 100 100 if ( is_object( $details ) && $details->spam == 1 ) 101 101 return new WP_Error('blog_suspended', __('Site Suspended.')); … … 103 103 } 104 104 105 $user data = apply_filters('wp_authenticate_user', $userdata, $password);106 if ( is_wp_error($user data) )107 return $user data;108 109 if ( !wp_check_password($password, $user data->user_pass, $userdata->ID) )105 $user = apply_filters('wp_authenticate_user', $user, $password); 106 if ( is_wp_error($user) ) 107 return $user; 108 109 if ( !wp_check_password($password, $user->user_pass, $user->ID) ) 110 110 return new WP_Error( 'incorrect_password', sprintf( __( '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s" title="Password Lost and Found">Lost your password</a>?' ), 111 111 $username, wp_lostpassword_url() ) ); 112 112 113 $user = new WP_User($userdata->ID);114 113 return $user; 115 114 } … … 256 255 257 256 if ( empty( $user ) ) 258 $user = wp_get_current_user(); 259 else 260 $user = new WP_User( $user ); 261 262 if ( ! $user->exists() ) 257 $user = get_current_user_id(); 258 259 if ( ! $user = get_userdata( $user ) ) 263 260 return false; 264 261 … … 929 926 930 927 if ( '' == $for_user_id ) 931 $user = wp_get_current_user(); 932 else 933 $user = new WP_User($for_user_id); 934 935 $userdata = null; 936 $user_ID = (int) $user->ID; 937 $user_level = (int) isset($user->user_level) ? $user->user_level : 0; 938 939 if ( ! $user->exists() ) { 928 $for_user_id = get_current_user_id(); 929 $user = get_userdata( $for_user_id ); 930 931 if ( ! $user ) { 932 $user_ID = 0; 933 $user_level = 0; 934 $userdata = null; 940 935 $user_login = $user_email = $user_url = $user_identity = ''; 941 936 return; 942 937 } 943 938 939 $user_ID = (int) $user->ID; 940 $user_level = (int) $user->user_level; 944 941 $userdata = $user; 945 942 $user_login = $user->user_login;
Note: See TracChangeset
for help on using the changeset viewer.