diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php
index bd4daa899c..6790cfe0e9 100644
--- a/wp-admin/includes/user.php
+++ b/wp-admin/includes/user.php
@@ -110,7 +110,7 @@ function edit_user( $user_id = 0 ) {
if ( isset( $_POST['description'] ) )
$user->description = trim( $_POST['description'] );
- foreach ( _wp_get_user_contactmethods() as $method => $name ) {
+ foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
if ( isset( $_POST[$method] ))
$user->$method = sanitize_text_field( $_POST[$method] );
}
@@ -224,7 +224,7 @@ function get_editable_roles() {
function get_user_to_edit( $user_id ) {
$user = new WP_User( $user_id );
- $user_contactmethods = _wp_get_user_contactmethods();
+ $user_contactmethods = _wp_get_user_contactmethods( $user );
foreach ($user_contactmethods as $method => $name) {
if ( empty( $user->{$method} ) )
$user->{$method} = '';
diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php
index be78208432..8f79e44e8b 100644
--- a/wp-admin/user-edit.php
+++ b/wp-admin/user-edit.php
@@ -322,7 +322,7 @@ else
$desc) {
+ foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
?>
|
diff --git a/wp-includes/registration.php b/wp-includes/registration.php
index 63f70e2132..39676e166c 100644
--- a/wp-includes/registration.php
+++ b/wp-includes/registration.php
@@ -211,20 +211,19 @@ function wp_insert_user($userdata) {
update_user_meta( $user_id, 'admin_color', $admin_color);
update_user_meta( $user_id, 'use_ssl', $use_ssl);
- foreach ( _wp_get_user_contactmethods() as $method => $name ) {
+ $user = new WP_User($user_id);
+
+ foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
if ( empty($$method) )
$$method = '';
update_user_meta( $user_id, $method, $$method );
}
- if ( isset($role) ) {
- $user = new WP_User($user_id);
+ if ( isset($role) )
$user->set_role($role);
- } elseif ( !$update ) {
- $user = new WP_User($user_id);
+ elseif ( !$update )
$user->set_role(get_option('default_role'));
- }
wp_cache_delete($user_id, 'users');
wp_cache_delete($user_login, 'userlogins');
@@ -319,15 +318,16 @@ function wp_create_user($username, $password, $email = '') {
* @access private
* @since
*
+ * @param object $user User data object (optional)
* @return array $user_contactmethods Array of contact methods and their labels.
*/
-function _wp_get_user_contactmethods() {
+function _wp_get_user_contactmethods( $user = null ) {
$user_contactmethods = array(
'aim' => __('AIM'),
'yim' => __('Yahoo IM'),
'jabber' => __('Jabber / Google Talk')
);
- return apply_filters('user_contactmethods',$user_contactmethods);
+ return apply_filters( 'user_contactmethods', $user_contactmethods, $user );
}
?>