_get_additional_user_keys example



    // First, get all of the original fields.     $user_obj = get_userdata( $user_id );
    if ( ! $user_obj ) {
        return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
    }

    $user = $user_obj->to_array();

    // Add additional custom fields.     foreach ( _get_additional_user_keys( $user_obj ) as $key ) {
        $user[ $key ] = get_user_meta( $user_id$key, true );
    }

    // Escape data pulled from DB.     $user = add_magic_quotes( $user );

    if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
        // If password is changing, hash it now.         $plaintext_pass        = $userdata['user_pass'];
        $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] );

        
Home | Imprint | This part of the site doesn't use cookies.