Deprecate get_author_link(). Add get_author_posts_url() and the_author_link(). Props Viper007Bond and westi. fixes #2423

git-svn-id: http://svn.automattic.com/wordpress/trunk@4139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-08-30 18:07:49 +00:00
parent e2f641e457
commit d71d2abfc7
2 changed files with 21 additions and 6 deletions

View File

@ -80,6 +80,14 @@ function the_author_url() {
echo get_the_author_url();
}
function the_author_link() {
if (get_the_author_url()) {
echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
} else {
the_author();
}
}
function get_the_author_icq() {
global $authordata;
return $authordata->icq;
@ -126,14 +134,14 @@ function the_author_posts() {
echo get_the_author_posts();
}
/* the_author_posts_link() requires no get_, use get_author_link() */
/* the_author_posts_link() requires no get_, use get_author_posts_url() */
function the_author_posts_link($idmode='') {
global $authordata;
echo '<a href="' . get_author_link(0, $authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(the_author($idmode, false))) . '">' . the_author($idmode, false) . '</a>';
echo '<a href="' . get_author_posts_url($authordata->ID, $authordata->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars(the_author($idmode, false))) . '">' . the_author($idmode, false) . '</a>';
}
function get_author_link($echo = false, $author_id, $author_nicename = '') {
function get_author_posts_url($author_id, $author_nicename = '') {
global $wpdb, $wp_rewrite, $post, $cache_userdata;
$auth_ID = $author_id;
$link = $wp_rewrite->get_author_permastruct();
@ -153,8 +161,6 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
$link = apply_filters('author_link', $link, $author_id, $author_nicename);
if ( $echo )
echo $link;
return $link;
}
@ -195,7 +201,7 @@ function wp_list_authors($args = '') {
if ( !$hide_empty )
$link = $name;
} else {
$link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
$link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) {
$link .= ' ';

View File

@ -477,4 +477,13 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
return wp_get_archives($args);
}
// Deprecated. Use get_author_posts_url().
function get_author_link($echo = false, $author_id, $author_nicename = '') {
$link = get_author_posts_link($author_id, $author_nicename);
if ( $echo )
echo $link;
return $link;
}
?>