129 | | $wpdb->hide_errors(); |
130 | | $metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user->ID'"); |
131 | | $wpdb->show_errors(); |
132 | | |
133 | | if ($metavalues) { |
134 | | foreach ( $metavalues as $meta ) { |
135 | | $value = maybe_unserialize($meta->meta_value); |
136 | | $user->{$meta->meta_key} = $value; |
137 | | |
138 | | // We need to set user_level from meta, not row |
139 | | if ( $wpdb->prefix . 'user_level' == $meta->meta_key ) |
140 | | $user->user_level = $meta->meta_value; |
141 | | } |
142 | | } |
143 | | |
144 | | // For backwards compat. |
145 | | if ( isset($user->first_name) ) |
146 | | $user->user_firstname = $user->first_name; |
147 | | if ( isset($user->last_name) ) |
148 | | $user->user_lastname = $user->last_name; |
149 | | if ( isset($user->description) ) |
150 | | $user->user_description = $user->description; |
151 | | |
152 | | wp_cache_add($user->ID, $user, 'users'); |
153 | | wp_cache_add($user->user_login, $user->ID, 'userlogins'); |
| 129 | $user = get_userdata($user_ID); |