WordPress.org

Make WordPress Core

Changeset 13464


Ignore:
Timestamp:
02/27/2010 06:11:45 PM (8 years ago)
Author:
nacin
Message:

Deprecate get_profile() for get_the_author_meta(). fixes #10695, props scribu.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r13425 r13464  
    24312431        remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+
    24322432}
     2433
     2434/**
     2435 * Retrieve user data based on field.
     2436 *
     2437 * @since 1.5.0
     2438 * @deprecated 3.0.0
     2439 * @deprecated Use get_the_author_meta()
     2440 * @see get_the_author_meta()
     2441 */
     2442function get_profile( $field, $user = false ) {
     2443    _deprecated_function(__FUNCTION__, '3.0', 'get_the_author_meta()' );
     2444    if ( $user ) {
     2445        $user = get_user_by( 'login', $user );
     2446        $user = $user->ID;
     2447    }
     2448    return get_the_author_meta( $field, $user );
     2449}
  • trunk/wp-includes/user.php

    r13382 r13464  
    138138
    139139    return $user;
    140 }
    141 
    142 /**
    143  * Retrieve user data based on field.
    144  *
    145  * Use get_profile() will make a database query to get the value of the table
    146  * column. The value might be cached using the query cache, but care should be
    147  * taken when using the function to not make a lot of queries for retrieving
    148  * user profile information.
    149  *
    150  * If the $user parameter is not used, then the user will be retrieved from a
    151  * cookie of the user. Therefore, if the cookie does not exist, then no value
    152  * might be returned. Sanity checking must be done to ensure that when using
    153  * get_profile() that empty/null/false values are handled and that something is
    154  * at least displayed.
    155  *
    156  * @since 1.5.0
    157  * @uses $wpdb WordPress database object to create queries.
    158  *
    159  * @param string $field User field to retrieve.
    160  * @param string $user Optional. User username.
    161  * @return string The value in the field.
    162  */
    163 function get_profile($field, $user = false) {
    164     global $wpdb;
    165     if ( !$user )
    166         $user = esc_sql( $_COOKIE[USER_COOKIE] );
    167     return $wpdb->get_var( $wpdb->prepare("SELECT $field FROM $wpdb->users WHERE user_login = %s", $user) );
    168140}
    169141
Note: See TracChangeset for help on using the changeset viewer.