WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/21/2010 03:42:06 PM (9 years ago)
Author:
nacin
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.