Make WordPress Core

Changeset 4139


Ignore:
Timestamp:
08/30/2006 06:07:49 PM (19 years ago)
Author:
ryan
Message:

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

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/author-template.php

    r4057 r4139  
    8181}
    8282
     83function the_author_link() {
     84    if (get_the_author_url()) {
     85        echo '<a href="' . get_the_author_url() . '" title="' . sprintf(__("Visit %s's website"), get_the_author()) . '" rel="external">' . get_the_author() . '</a>';
     86    } else {
     87        the_author();
     88    }
     89}
     90
    8391function get_the_author_icq() {
    8492    global $authordata;
     
    127135}
    128136
    129 /* the_author_posts_link() requires no get_, use get_author_link() */
     137/* the_author_posts_link() requires no get_, use get_author_posts_url() */
    130138function the_author_posts_link($idmode='') {
    131139    global $authordata;
    132140
    133     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>';
    134 }
    135 
    136 function get_author_link($echo = false, $author_id, $author_nicename = '') {
     141    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>';
     142}
     143
     144function get_author_posts_url($author_id, $author_nicename = '') {
    137145    global $wpdb, $wp_rewrite, $post, $cache_userdata;
    138146    $auth_ID = $author_id;
     
    154162    $link = apply_filters('author_link', $link, $author_id, $author_nicename);
    155163
    156     if ( $echo )
    157         echo $link;
    158164    return $link;
    159165}
     
    196202                $link = $name;
    197203        } else {
    198             $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
     204            $link = '<a href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
    199205
    200206            if ( (! empty($feed_image)) || (! empty($feed)) ) {
  • trunk/wp-includes/deprecated.php

    r3941 r4139  
    478478}
    479479
     480// Deprecated. Use get_author_posts_url().
     481function get_author_link($echo = false, $author_id, $author_nicename = '') {
     482    $link = get_author_posts_link($author_id, $author_nicename);
     483
     484    if ( $echo )
     485        echo $link;
     486    return $link;
     487}
     488
    480489?>
Note: See TracChangeset for help on using the changeset viewer.