WordPress.org

Make WordPress Core

Changeset 15896


Ignore:
Timestamp:
10/21/10 15:42:06 (6 years ago)
Author:
nacin
Message:

Pass user object through _wp_get_user_contactmethods() to the user_contactmethods filter. props aaroncampbell, fixes #15186.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/user.php

    r15799 r15896  
    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] ); 
     
    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} ) ) 
  • trunk/wp-admin/user-edit.php

    r15830 r15896  
    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> 
  • trunk/wp-includes/registration.php

    r14504 r15896  
    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 = ''; 
     
    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'); 
     
    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'), 
     
    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 
Note: See TracChangeset for help on using the changeset viewer.