diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 8c6bf2b7c..b3e2a9373 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -105,12 +105,11 @@ function edit_user( $user_id = 0 ) { $user->display_name = esc_html( trim( $_POST['display_name'] )); if ( isset( $_POST['description'] )) $user->description = trim( $_POST['description'] ); - if ( isset( $_POST['jabber'] )) - $user->jabber = esc_html( trim( $_POST['jabber'] )); - if ( isset( $_POST['aim'] )) - $user->aim = esc_html( trim( $_POST['aim'] )); - if ( isset( $_POST['yim'] )) - $user->yim = esc_html( trim( $_POST['yim'] )); + $user_contactmethods = _wp_get_user_contactmethods(); + foreach ($user_contactmethods as $method => $name) { + if ( isset( $_POST[$method] )) + $user->$method = esc_html( trim( $_POST[$method] ) ); + } if ( !$update ) $user->rich_editing = 'true'; // Default to true for new users. else if ( isset( $_POST['rich_editing'] ) ) @@ -378,9 +377,12 @@ function get_user_to_edit( $user_id ) { $user->last_name = esc_attr($user->last_name); $user->display_name = esc_attr($user->display_name); $user->nickname = esc_attr($user->nickname); - $user->aim = isset( $user->aim ) && !empty( $user->aim ) ? esc_attr($user->aim) : ''; - $user->yim = isset( $user->yim ) && !empty( $user->yim ) ? esc_attr($user->yim) : ''; - $user->jabber = isset( $user->jabber ) && !empty( $user->jabber ) ? esc_attr($user->jabber) : ''; + + $user_contactmethods = _wp_get_user_contactmethods(); + foreach ($user_contactmethods as $method => $name) { + $user->{$method} = isset( $user->{$method} ) && !empty( $user->{$method} ) ? esc_attr($user->{$method}) : ''; + } + $user->description = isset( $user->description ) && !empty( $user->description ) ? esc_html($user->description) : ''; return $user; @@ -835,4 +837,21 @@ function default_password_nag() { echo '

'; } +/** + * Setup the default contact methods + * + * @access private + * @since + * + * @return array $user_contactmethods Array of contact methods and their labels. + */ +function _wp_get_user_contactmethods() { + $user_contactmethods = array( + 'aim' => __('AIM'), + 'yim' => __('Yahoo IM'), + 'jabber' => __('Jabber / Google Talk') + ); + return apply_filters('user_contactmethods',$user_contactmethods); +} + ?> diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 6736e1c8a..7f556084a 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -267,20 +267,16 @@ else + $desc) { +?> - - - - - - - - - - - - - + + + +

diff --git a/wp-includes/registration.php b/wp-includes/registration.php index 3dfb672c1..1481e24b8 100644 --- a/wp-includes/registration.php +++ b/wp-includes/registration.php @@ -164,15 +164,6 @@ function wp_insert_user($userdata) { if ( empty($use_ssl) ) $use_ssl = 0; - if ( empty($jabber) ) - $jabber = ''; - - if ( empty($aim) ) - $aim = ''; - - if ( empty($yim) ) - $yim = ''; - if ( empty($user_registered) ) $user_registered = gmdate('Y-m-d H:i:s'); @@ -203,13 +194,16 @@ function wp_insert_user($userdata) { update_usermeta( $user_id, 'last_name', $last_name); update_usermeta( $user_id, 'nickname', $nickname ); update_usermeta( $user_id, 'description', $description ); - update_usermeta( $user_id, 'jabber', $jabber ); - update_usermeta( $user_id, 'aim', $aim ); - update_usermeta( $user_id, 'yim', $yim ); update_usermeta( $user_id, 'rich_editing', $rich_editing); update_usermeta( $user_id, 'comment_shortcuts', $comment_shortcuts); update_usermeta( $user_id, 'admin_color', $admin_color); update_usermeta( $user_id, 'use_ssl', $use_ssl); + foreach (_wp_get_user_contactmethods() as $method => $name) { + if ( empty($$method) ) + $$method = ''; + + update_usermeta( $user_id, $method, $$method ); + } if ( isset($role) ) { $user = new WP_User($user_id);