From d48e85e0ac5e675ca33fac173f30c75403d1033f Mon Sep 17 00:00:00 2001 From: donncha Date: Thu, 22 Jun 2006 18:31:50 +0000 Subject: Moved everything in wp-inst down a directory. Uses's Ryan Boren's htaccess rules and mods If you're upgrading, try this on a test server first! git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@591 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/author-template.php | 233 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 wp-includes/author-template.php (limited to 'wp-includes/author-template.php') diff --git a/wp-includes/author-template.php b/wp-includes/author-template.php new file mode 100644 index 0000000..f265b3b --- /dev/null +++ b/wp-includes/author-template.php @@ -0,0 +1,233 @@ +display_name); +} + +function the_author($idmode = '', $echo = true) { + if ( $echo ) + echo get_the_author($idmode); + return get_the_author($idmode); +} + +function get_the_author_description() { + global $authordata; + return $authordata->description; +} +function the_author_description() { + echo get_the_author_description(); +} + +function get_the_author_login() { + global $authordata; + return $authordata->user_login; +} + +function the_author_login() { + echo get_the_author_login(); +} + +function get_the_author_firstname() { + global $authordata; + return $authordata->first_name; +} +function the_author_firstname() { + echo get_the_author_firstname(); +} + +function get_the_author_lastname() { + global $authordata; + return $authordata->last_name; +} + +function the_author_lastname() { + echo get_the_author_lastname(); +} + +function get_the_author_nickname() { + global $authordata; + return $authordata->nickname; +} + +function the_author_nickname() { + echo get_the_author_nickname(); +} + +function get_the_author_ID() { + global $authordata; + return $authordata->ID; +} +function the_author_ID() { + echo get_the_author_id(); +} + +function get_the_author_email() { + global $authordata; + return $authordata->user_email; +} + +function the_author_email() { + echo apply_filters('the_author_email', get_the_author_email() ); +} + +function get_the_author_url() { + global $authordata; + return $authordata->user_url; +} + +function the_author_url() { + echo get_the_author_url(); +} + +function get_the_author_icq() { + global $authordata; + return $authordata->icq; +} + +function the_author_icq() { + echo get_the_author_icq(); +} + +function get_the_author_aim() { + global $authordata; + return str_replace(' ', '+', $authordata->aim); +} + +function the_author_aim() { + echo get_the_author_aim(); +} + +function get_the_author_yim() { + global $authordata; + return $authordata->yim; +} + +function the_author_yim() { + echo get_the_author_yim(); +} + +function get_the_author_msn() { + global $authordata; + return $authordata->msn; +} + +function the_author_msn() { + echo get_the_author_msn(); +} + +function get_the_author_posts() { + global $post; + $posts = get_usernumposts($post->post_author); + return $posts; +} + +function the_author_posts() { + echo get_the_author_posts(); +} + +/* the_author_posts_link() requires no get_, use get_author_link() */ +function the_author_posts_link($idmode='') { + global $authordata; + + echo '' . the_author($idmode, false) . ''; +} + +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(); + + if ( empty($link) ) { + $file = get_settings('home') . '/'; + $link = $file . '?author=' . $auth_ID; + } else { + if ( '' == $author_nicename ) + $author_nicename = $cache_userdata[$author_id]->user_nicename; + $link = str_replace('%author%', $author_nicename, $link); + $link = get_settings('home') . trailingslashit($link); + } + + $link = apply_filters('author_link', $link, $author_id, $author_nicename); + + if ( $echo ) + echo $link; + return $link; +} + +// Get author's preferred display name +function get_author_name( $auth_id ) { + $authordata = get_userdata( $auth_id ); + + return $authordata->display_name; +} + +function wp_list_authors($args = '') { + if ( is_array($args) ) + $r = &$args; + else + parse_str($args, $r); + + $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, + 'feed' => '', 'feed_image' => ''); + $r = array_merge($defaults, $r); + extract($r); + + global $wpdb; + // TODO: Move select to get_authors(). + $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 ) { + $author = get_userdata( $author->ID ); + $posts = get_usernumposts($author->ID); + $name = $author->nickname; + + if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') ) + $name = "$author->first_name $author->last_name"; + + if ( !($posts == 0 && $hide_empty) ) + echo "
  • "; + if ( $posts == 0 ) { + if ( !$hide_empty ) + $link = $name; + } else { + $link = 'display_name)) . '">' . $name . ''; + + if ( (! empty($feed_image)) || (! empty($feed)) ) { + $link .= ' '; + if (empty($feed_image)) + $link .= '('; + $link .= ''; + else + $link .= $name; + + $link .= ''; + + if ( empty($feed_image) ) + $link .= ')'; + } + + if ( $optioncount ) + $link .= ' ('. $posts . ')'; + + } + + if ( !($posts == 0 && $hide_empty) ) + echo "$link
  • "; + } +} + +?> \ No newline at end of file -- cgit