]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/template-functions-author.php
Wordpress 2.0.4
[autoinstalls/wordpress.git] / wp-includes / template-functions-author.php
index 4f443b38f2345797c07d780171c12a5e1bd23b3b..0838f5ff1c2a46a7832fc0c5a295b37f0b7f7917 100644 (file)
@@ -133,7 +133,7 @@ function the_author_posts_link($idmode='') {
        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>';
 }
 
-function get_author_link($echo = false, $author_id, $author_nicename) {
+function get_author_link($echo = false, $author_id, $author_nicename = '') {
        global $wpdb, $wp_rewrite, $post, $cache_userdata;
        $auth_ID = $author_id;
        $link = $wp_rewrite->get_author_permastruct();
@@ -142,8 +142,11 @@ function get_author_link($echo = false, $author_id, $author_nicename) {
                $file = get_settings('home') . '/';
                $link = $file . '?author=' . $auth_ID;
        } else {
-               if ( '' == $author_nicename )
-                       $author_nicename = $cache_userdata[$author_id]->user_nicename;
+               if ( '' == $author_nicename ) {
+                       $user = get_userdata($author_id);
+                       if ( !empty($user->user_nicename) )
+                               $author_nicename = $user->user_nicename;
+               }
                $link = str_replace('%author%', $author_nicename, $link);
                $link = get_settings('home') . trailingslashit($link);
        }