Ticket #15458: wp_update_users.15458.diff
File wp_update_users.15458.diff, 2.9 KB (added by , 13 years ago) |
---|
-
wp-includes/capabilities.php
diff --git wp-includes/capabilities.php wp-includes/capabilities.php index deb50ce..310d248 100644
class WP_User { 474 474 * 475 475 * @param string $field The field to query against: 'id', 'slug', 'email' or 'login' 476 476 * @param string|int $value The field value 477 * @return object Raw user object 477 478 */ 478 479 static function get_data_by( $field, $value ) { 479 480 global $wpdb; … … class WP_User { 618 619 * property matching the 'cap_key' exists and is an array. If so, it will be 619 620 * used. 620 621 * 622 * @access protected 621 623 * @since 2.1.0 622 624 * 623 625 * @param string $cap_key Optional capability key 624 * @access protected625 626 */ 626 627 function _init_caps( $cap_key = '' ) { 627 628 global $wpdb; -
wp-includes/user.php
diff --git wp-includes/user.php wp-includes/user.php index e339eb5..f0bdd96 100644
function wp_insert_user($userdata) { 1353 1353 $user_id = (int) $wpdb->insert_id; 1354 1354 } 1355 1355 1356 update_user_meta( $user_id, 'first_name', $first_name ); 1357 update_user_meta( $user_id, 'last_name', $last_name ); 1358 update_user_meta( $user_id, 'nickname', $nickname ); 1359 update_user_meta( $user_id, 'description', $description ); 1360 update_user_meta( $user_id, 'rich_editing', $rich_editing ); 1361 update_user_meta( $user_id, 'comment_shortcuts', $comment_shortcuts ); 1362 update_user_meta( $user_id, 'admin_color', $admin_color ); 1363 update_user_meta( $user_id, 'use_ssl', $use_ssl ); 1364 update_user_meta( $user_id, 'show_admin_bar_front', $show_admin_bar_front ); 1365 1366 $user = new WP_User($user_id); 1356 foreach ( _get_additional_user_keys() as $key ) { 1357 update_user_meta( $user_id, $key, $$key ); 1358 } 1359 1360 $user = new WP_User( $user_id ); 1367 1361 1368 1362 foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) { 1369 1363 if ( empty($$method) ) … … function wp_update_user($userdata) { 1411 1405 $ID = (int) $userdata['ID']; 1412 1406 1413 1407 // First, get all of the original fields 1414 $user = WP_User::get_data_by('id', $ID); 1408 $user = get_object_vars( WP_User::get_data_by( 'id', $ID ) ); 1409 1410 // Add additional custom fields 1411 foreach ( _get_additional_user_keys() as $key ) { 1412 $user[ $key ] = get_user_meta( $ID, $key, true ); 1413 } 1415 1414 1416 1415 // Escape data pulled from DB. 1417 $user = add_magic_quotes( get_object_vars($user));1416 $user = add_magic_quotes( $user ); 1418 1417 1419 1418 // If password is changing, hash it now. 1420 1419 if ( ! empty($userdata['user_pass']) ) { … … function wp_create_user($username, $password, $email = '') { 1465 1464 1466 1465 1467 1466 /** 1467 * Return a list of meta keys that wp_insert_user() is supposed to set. 1468 * 1469 * @access private 1470 * @since 3.3.0 1471 * 1472 * @return array 1473 */ 1474 function _get_additional_user_keys() { 1475 return array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front' ); 1476 } 1477 1478 /** 1468 1479 * Set up the default contact methods 1469 1480 * 1470 1481 * @access private