Make WordPress Core

Ticket #15186: 15186.001.diff

File 15186.001.diff, 2.8 KB (added by aaroncampbell, 14 years ago)
  • wp-admin/includes/user.php

     
    110110        if ( isset( $_POST['description'] ) )
    111111                $user->description = trim( $_POST['description'] );
    112112
    113         foreach ( _wp_get_user_contactmethods() as $method => $name ) {
     113        foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
    114114                if ( isset( $_POST[$method] ))
    115115                        $user->$method = sanitize_text_field( $_POST[$method] );
    116116        }
     
    224224function get_user_to_edit( $user_id ) {
    225225        $user = new WP_User( $user_id );
    226226
    227         $user_contactmethods = _wp_get_user_contactmethods();
     227        $user_contactmethods = _wp_get_user_contactmethods( $user );
    228228        foreach ($user_contactmethods as $method => $name) {
    229229                if ( empty( $user->{$method} ) )
    230230                        $user->{$method} = '';
  • wp-admin/user-edit.php

     
    322322</tr>
    323323
    324324<?php
    325         foreach (_wp_get_user_contactmethods() as $name => $desc) {
     325        foreach (_wp_get_user_contactmethods( $profileuser ) as $name => $desc) {
    326326?>
    327327<tr>
    328328        <th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
  • wp-includes/registration.php

     
    211211        update_user_meta( $user_id, 'admin_color', $admin_color);
    212212        update_user_meta( $user_id, 'use_ssl', $use_ssl);
    213213
    214         foreach ( _wp_get_user_contactmethods() as $method => $name ) {
     214        $user = new WP_User($user_id);
     215
     216        foreach ( _wp_get_user_contactmethods( $user ) as $method => $name ) {
    215217                if ( empty($$method) )
    216218                        $$method = '';
    217219
    218220                update_user_meta( $user_id, $method, $$method );
    219221        }
    220222
    221         if ( isset($role) ) {
    222                 $user = new WP_User($user_id);
     223        if ( isset($role) )
    223224                $user->set_role($role);
    224         } elseif ( !$update ) {
    225                 $user = new WP_User($user_id);
     225        elseif ( !$update )
    226226                $user->set_role(get_option('default_role'));
    227         }
    228227
    229228        wp_cache_delete($user_id, 'users');
    230229        wp_cache_delete($user_login, 'userlogins');
     
    319318 * @access private
    320319 * @since
    321320 *
     321 * @param object $user User data object (optional)
    322322 * @return array $user_contactmethods Array of contact methods and their labels.
    323323 */
    324 function _wp_get_user_contactmethods() {
     324function _wp_get_user_contactmethods( $user = null ) {
    325325        $user_contactmethods = array(
    326326                'aim' => __('AIM'),
    327327                'yim' => __('Yahoo IM'),
    328328                'jabber' => __('Jabber / Google Talk')
    329329        );
    330         return apply_filters('user_contactmethods',$user_contactmethods);
     330        return apply_filters( 'user_contactmethods', $user_contactmethods, $user );
    331331}
    332332
    333333?>