Index: wp-includes/author-template.php
===================================================================
--- wp-includes/author-template.php (revision 11001)
+++ wp-includes/author-template.php (working copy)
@@ -80,194 +80,39 @@
}
/**
- * Retrieve the description of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's description.
+ * Retrieve the requested data of the author of the current post.
+ * @link http://codex.wordpress.org/Template_Tags/the_author_meta
+ * @since 2.8.0
+ * @param string $field selects the field of the users record.
+ * @return string The author's field from the current author's DB object.
*/
-function get_the_author_description() {
- global $authordata;
- return $authordata->description;
-}
+function get_the_author_meta($field = '', $user_id = false) {
+ if ( ! $user_id )
+ global $authordata;
+ else
+ $authordata = get_userdata( $auth_id );
+var_dump($authordata);
+ $field = strtolower($field);
+ if ( 'id' == $field )
+ $value = isset($authordata->ID) ? (int)$authordata->ID : 0;
+ else
+ $value = isset($authordata->$field) ? $authordata->$field : '';
-/**
- * Display the description of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_description
- * @since 1.0.0
- * @see get_the_author_description()
- */
-function the_author_description() {
- echo get_the_author_description();
+ return apply_filters('get_the_author_' . $field, $value);
}
/**
- * Retrieve the login name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's login name (username).
+ * Retrieve the requested data of the author of the current post.
+ * @link http://codex.wordpress.org/Template_Tags/the_author_meta
+ * @since 2.8.0
+ * @param string $field selects the field of the users record.
+ * @echo string The author's field from the current author's DB object.
*/
-function get_the_author_login() {
- global $authordata;
- return $authordata->user_login;
+function the_author_meta($field = '', $user_id = false) {
+ echo apply_filters('the_author_' . $field, get_the_author_meta($field, $user_id));
}
/**
- * Display the login name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_login
- * @since 0.71
- * @see get_the_author_login()
- */
-function the_author_login() {
- echo get_the_author_login();
-}
-
-/**
- * Retrieve the first name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's first name.
- */
-function get_the_author_firstname() {
- global $authordata;
- return $authordata->first_name;
-}
-
-/**
- * Display the first name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
- * @since 0.71
- * @uses get_the_author_firstname()
- */
-function the_author_firstname() {
- echo get_the_author_firstname();
-}
-
-/**
- * Retrieve the last name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's last name.
- */
-function get_the_author_lastname() {
- global $authordata;
- return $authordata->last_name;
-}
-
-/**
- * Display the last name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
- * @since 0.71
- * @uses get_the_author_lastname()
- */
-function the_author_lastname() {
- echo get_the_author_lastname();
-}
-
-/**
- * Retrieve the nickname of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's nickname.
- */
-function get_the_author_nickname() {
- global $authordata;
- return $authordata->nickname;
-}
-
-/**
- * Display the nickname of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
- * @since 0.71
- * @uses get_the_author_nickname()
- */
-function the_author_nickname() {
- echo get_the_author_nickname();
-}
-
-/**
- * Retrieve the ID of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return int The author's ID.
- */
-function get_the_author_ID() {
- global $authordata;
- return (int) $authordata->ID;
-}
-
-/**
- * Display the ID of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_ID
- * @since 0.71
- * @uses get_the_author_ID()
- */
-function the_author_ID() {
- echo get_the_author_id();
-}
-
-/**
- * Retrieve the email of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's username.
- */
-function get_the_author_email() {
- global $authordata;
- return $authordata->user_email;
-}
-
-/**
- * Display the email of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_email
- * @since 0.71
- * @uses get_the_author_email()
- */
-function the_author_email() {
- echo apply_filters('the_author_email', get_the_author_email() );
-}
-
-/**
- * Retrieve the URL to the home page of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The URL to the author's page.
- */
-function get_the_author_url() {
- global $authordata;
-
- if ( 'http://' == $authordata->user_url )
- return '';
-
- return $authordata->user_url;
-}
-
-/**
- * Display the URL to the home page of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_url
- * @since 0.71
- * @uses get_the_author_url()
- */
-function the_author_url() {
- echo get_the_author_url();
-}
-
-/**
* Display either author's link or author's name.
*
* If the author has a home page set, echo an HTML link, otherwise just echo the
@@ -287,98 +132,6 @@
}
/**
- * Retrieve the ICQ number of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's ICQ number.
- */
-function get_the_author_icq() {
- global $authordata;
- return $authordata->icq;
-}
-
-/**
- * Display the ICQ number of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_icq
- * @since 0.71
- * @see get_the_author_icq()
- */
-function the_author_icq() {
- echo get_the_author_icq();
-}
-
-/**
- * Retrieve the AIM name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's AIM name.
- */
-function get_the_author_aim() {
- global $authordata;
- return str_replace(' ', '+', $authordata->aim);
-}
-
-/**
- * Display the AIM name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_aim
- * @since 0.71
- * @see get_the_author_aim()
- */
-function the_author_aim() {
- echo get_the_author_aim();
-}
-
-/**
- * Retrieve the Yahoo! IM name of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's Yahoo! IM name.
- */
-function get_the_author_yim() {
- global $authordata;
- return $authordata->yim;
-}
-
-/**
- * Display the Yahoo! IM name of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_yim
- * @since 0.71
- * @see get_the_author_yim()
- */
-function the_author_yim() {
- echo get_the_author_yim();
-}
-
-/**
- * Retrieve the MSN address of the author of the current post.
- *
- * @since 1.5
- * @uses $authordata The current author's DB object.
- * @return string The author's MSN address.
- */
-function get_the_author_msn() {
- global $authordata;
- return $authordata->msn;
-}
-
-/**
- * Display the MSN address of the author of the current post.
- *
- * @link http://codex.wordpress.org/Template_Tags/the_author_msn
- * @since 0.71
- * @see get_the_author_msn()
- */
-function the_author_msn() {
- echo get_the_author_msn();
-}
-
-/**
* Retrieve the number of posts by the author of the current post.
*
* @since 1.5
@@ -457,18 +210,6 @@
}
/**
- * Retrieve the specified author's preferred display name.
- *
- * @since 1.0.0
- * @param int $auth_id The ID of the author.
- * @return string The author's display name.
- */
-function get_author_name( $auth_id ) {
- $authordata = get_userdata( $auth_id );
- return $authordata->display_name;
-}
-
-/**
* List all the authors of the blog, with several options available.
*
*
Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php (revision 11001)
+++ wp-includes/default-filters.php (working copy)
@@ -97,6 +97,10 @@
add_filter($filter, 'convert_chars');
}
+//Author Data Filters
+add_filter('get_the_author_user_url', '_filter_empty_url');
+add_filter('get_the_author_aim', 'urlencode');
+
// Display filters
add_filter('the_title', 'wptexturize');
add_filter('the_title', 'convert_chars');
Index: wp-includes/deprecated.php
===================================================================
--- wp-includes/deprecated.php (revision 11001)
+++ wp-includes/deprecated.php (working copy)
@@ -1353,4 +1353,313 @@
return $chain;
}
+/**
+ * Retrieve the description of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's description.
+ * @deprecated Use the_author_meta('description')
+ */
+function get_the_author_description() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'description\')' );
+ return get_the_author_meta('description');
+}
+
+/**
+ * Display the description of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_description
+ * @since 1.0.0
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('description')
+ */
+function the_author_description() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'description\')' );
+ the_author_meta('description');
+}
+
+/**
+ * Retrieve the login name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's login name (username).
+ * @deprecated Use the_author_meta('user_login')
+ */
+function get_the_author_login() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'user_login\')' );
+ return get_the_author_meta('user_login');
+}
+
+/**
+ * Display the login name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_login
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('user_login')
+ */
+function the_author_login() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_login\')' );
+ the_author_meta('user_login');
+}
+
+/**
+ * Retrieve the first name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's first name.
+ * @deprecated Use the_author_meta('first_name')
+ */
+function get_the_author_firstname() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'first_name\')' );
+ return get_the_author_meta('first_name');
+}
+
+/**
+ * Display the first name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_firstname
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('first_name')
+ */
+function the_author_firstname() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'first_name\')' );
+ the_author_meta('first_name');
+}
+
+/**
+ * Retrieve the last name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's last name.
+ * @deprecated Use the_author_meta('last_name')
+ */
+function get_the_author_lastname() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'last_name\')' );
+ return get_the_author_meta('last_name');
+}
+
+/**
+ * Display the last name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_lastname
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('last_name')
+ */
+function the_author_lastname() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'last_name\')' );
+ the_author_meta('last_name');
+}
+
+/**
+ * Retrieve the nickname of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's nickname.
+ * @deprecated Use the_author_meta('nickname')
+ */
+function get_the_author_nickname() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'nickname\')' );
+ return get_the_author_meta('nickname');
+}
+
+/**
+ * Display the nickname of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_nickname
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('nickname')
+ */
+function the_author_nickname() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'nickname\')' );
+ the_author_meta('nickname');
+}
+
+/**
+ * Retrieve the email of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's username.
+ * @deprecated Use the_author_meta('user_email')
+ */
+function get_the_author_email() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'user_email\')' );
+ return get_the_author_meta('user_email');
+}
+
+/**
+ * Display the email of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_email
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('user_email')
+ */
+function the_author_email() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_email\')' );
+ the_author_meta('user_email');
+}
+
+/**
+ * Retrieve the ICQ number of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's ICQ number.
+ * @deprecated Use the_author_meta('icq')
+ */
+function get_the_author_icq() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'icq\')' );
+ return get_the_author_meta('icq');
+}
+
+/**
+ * Display the ICQ number of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_icq
+ * @since 0.71
+ * @deprecated 2.8
+ * @see get_the_author_icq()
+ * @deprecated Use the_author_meta('icq')
+ */
+function the_author_icq() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'icq\')' );
+ the_author_meta('icq');
+}
+
+/**
+ * Retrieve the Yahoo! IM name of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's Yahoo! IM name.
+ * @deprecated Use the_author_meta('yim')
+ */
+function get_the_author_yim() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'yim\')' );
+ return get_the_author_meta('yim');
+}
+
+/**
+ * Display the Yahoo! IM name of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_yim
+ * @since 0.71
+ * @deprecated 2.8
+ * @deprecated Use the_author_meta('yim')
+ */
+function the_author_yim() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'yim\')' );
+ the_author_meta('yim');
+}
+
+/**
+ * Retrieve the MSN address of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The author's MSN address.
+ * @deprecated Use the_author_meta('msn')
+ */
+function get_the_author_msn() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'msn\')' );
+ return get_the_author_meta('msn');
+}
+
+/**
+ * Display the MSN address of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_msn
+ * @since 0.71
+ * @deprecated 2.8
+ * @see get_the_author_msn()
+ * @deprecated Use the_author_meta('msn')
+ */
+function the_author_msn() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'msn\')' );
+ the_author_meta('msn');
+}
+
+/**
+ * Retrieve the specified author's preferred display name.
+ *
+ * @since 1.0.0
+ * @deprecated 2.8
+ * @param int $auth_id The ID of the author.
+ * @return string The author's display name.
+ * @deprecated Use the_author_meta('display_name')
+ */
+function get_author_name( $auth_id = false ) {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'display_name\')' );
+ return get_the_author_meta('display_name', $auth_id);
+}
+
+/**
+ * Retrieve the URL to the home page of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @uses $authordata The current author's DB object.
+ * @return string The URL to the author's page.
+ */
+function get_the_author_url() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'user_url\')' );
+ return get_the_author_meta('user_url');
+}
+
+/**
+ * Display the URL to the home page of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_url
+ * @since 0.71
+ * @deprecated 2.8
+ */
+function the_author_url() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_url\')' );
+ the_author_meta('user_url');
+}
+
+/**
+ * Retrieve the ID of the author of the current post.
+ *
+ * @since 1.5
+ * @deprecated 2.8
+ * @return int The author's ID.
+ */
+function get_the_author_ID() {
+ _deprecated_function(__FUNCTION__, '2.8', 'get_the_author_meta(\'ID\')' );
+ return get_the_author_meta('ID');
+}
+
+/**
+ * Display the ID of the author of the current post.
+ *
+ * @link http://codex.wordpress.org/Template_Tags/the_author_ID
+ * @since 0.71
+ * @deprecated 2.8
+ * @uses get_the_author_ID()
+*/
+function the_author_ID() {
+ _deprecated_function(__FUNCTION__, '2.8', 'the_author_meta(\'user_url\')' );
+ the_author_meta('ID');
+}
+
?>
\ No newline at end of file
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php (revision 11001)
+++ wp-includes/functions.php (working copy)
@@ -3144,5 +3145,15 @@
return $structure;
}
+/**
+ * Filters links to return an empty string if only http:// is present.
+ *
+ * @since 2.8.0
+ * @param string $link The input link
+ * @return string empty string, or link depending on input.
+ */
+function _filter_empty_url($link) {
+ return 'http://' == $link ? '' : $link;
+}
?>