From f015c58d278f0afb2820a68f2e4b1912983d081f Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 27 Feb 2010 18:11:45 +0000 Subject: [PATCH] Deprecate get_profile() for get_the_author_meta(). fixes #10695, props scribu. git-svn-id: https://develop.svn.wordpress.org/trunk@13464 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/deprecated.php | 17 +++++++++++++++++ wp-includes/user.php | 28 ---------------------------- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index a552829e49..f8034d8c1e 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2429,4 +2429,21 @@ function automatic_feed_links( $add = true ) { add_theme_support( 'automatic-feed-links' ); else remove_action( 'wp_head', 'feed_links_extra', 3 ); // Just do this yourself in 3.0+ +} + +/** + * Retrieve user data based on field. + * + * @since 1.5.0 + * @deprecated 3.0.0 + * @deprecated Use get_the_author_meta() + * @see get_the_author_meta() + */ +function get_profile( $field, $user = false ) { + _deprecated_function(__FUNCTION__, '3.0', 'get_the_author_meta()' ); + if ( $user ) { + $user = get_user_by( 'login', $user ); + $user = $user->ID; + } + return get_the_author_meta( $field, $user ); } \ No newline at end of file diff --git a/wp-includes/user.php b/wp-includes/user.php index 3a63eba8f6..373bedfd69 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -139,34 +139,6 @@ function wp_authenticate_cookie($user, $username, $password) { return $user; } -/** - * Retrieve user data based on field. - * - * Use get_profile() will make a database query to get the value of the table - * column. The value might be cached using the query cache, but care should be - * taken when using the function to not make a lot of queries for retrieving - * user profile information. - * - * If the $user parameter is not used, then the user will be retrieved from a - * cookie of the user. Therefore, if the cookie does not exist, then no value - * might be returned. Sanity checking must be done to ensure that when using - * get_profile() that empty/null/false values are handled and that something is - * at least displayed. - * - * @since 1.5.0 - * @uses $wpdb WordPress database object to create queries. - * - * @param string $field User field to retrieve. - * @param string $user Optional. User username. - * @return string The value in the field. - */ -function get_profile($field, $user = false) { - global $wpdb; - if ( !$user ) - $user = esc_sql( $_COOKIE[USER_COOKIE] ); - return $wpdb->get_var( $wpdb->prepare("SELECT $field FROM $wpdb->users WHERE user_login = %s", $user) ); -} - /** * Number of posts user has written. *