X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/ff81ee6e8304a1982a3ec4f5b134764a29d502cf..0f29eadd474473203a1182f52af1aa82721cecbd:/wp-includes/template-functions-author.php diff --git a/wp-includes/template-functions-author.php b/wp-includes/template-functions-author.php index 4f443b38..1107e034 100644 --- a/wp-includes/template-functions-author.php +++ b/wp-includes/template-functions-author.php @@ -1,14 +1,15 @@ display_name); } -function the_author($idmode = '', $echo = true) { - if ( $echo ) - echo get_the_author($idmode); - return get_the_author($idmode); +// Using echo = false is deprecated. Use get_the_author instead. +function the_author($deprecated = '', $deprecated_echo = true) { + if ( $deprecated_echo ) + echo get_the_author(); + return get_the_author(); } function get_the_author_description() { @@ -127,23 +128,26 @@ function the_author_posts() { } /* the_author_posts_link() requires no get_, use get_author_link() */ -function the_author_posts_link($idmode='') { +function the_author_posts_link($deprecated = '') { global $authordata; - echo '' . the_author($idmode, false) . ''; + echo '' . get_the_author() . ''; } -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; + $auth_ID = (int) $author_id; $link = $wp_rewrite->get_author_permastruct(); if ( empty($link) ) { $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); } @@ -179,7 +183,7 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name"; $authors = $wpdb->get_results($query); - foreach ( $authors as $author ) { + foreach ( (array) $authors as $author ) { $author = get_userdata( $author->ID ); $posts = get_usernumposts($author->ID); $name = $author->nickname; @@ -193,7 +197,7 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam if ( !$hide_empty ) $link = $name; } else { - $link = 'display_name)) . '">' . $name . ''; + $link = 'display_name)) . '">' . $name . ''; if ( (! empty($feed_image)) || (! empty($feed)) ) { $link .= ' '; @@ -231,4 +235,4 @@ function list_authors($optioncount = false, $exclude_admin = true, $show_fullnam } } -?> \ No newline at end of file +?>