Deprecate get_profile() for get_the_author_meta(). fixes #10695, props scribu.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1c5f2af719
commit
d662f07784
|
@ -2430,3 +2430,20 @@ function automatic_feed_links( $add = true ) {
|
|||
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 );
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue