[ Index ]

WordPress Source Cross Reference

title

Body

[close]

/wp-includes/ -> author-template.php (source)

   1  <?php
   2  
   3  function get_the_author($idmode = '') {
   4      global $authordata;
   5      return apply_filters('the_author', $authordata->display_name);
   6  }
   7  
   8  function the_author($idmode = '', $echo = true) {
   9      if ( $echo )
  10          echo get_the_author($idmode);
  11      return get_the_author($idmode);
  12  }
  13  
  14  function get_the_author_description() {
  15      global $authordata;
  16      return $authordata->description;
  17  }
  18  function the_author_description() {
  19      echo get_the_author_description();
  20  }
  21  
  22  function get_the_author_login() {
  23      global $authordata;
  24      return $authordata->user_login;
  25  }
  26  
  27  function the_author_login() {
  28      echo get_the_author_login();
  29  }
  30  
  31  function get_the_author_firstname() {
  32      global $authordata;
  33      return $authordata->first_name;
  34  }
  35  function the_author_firstname() {
  36      echo get_the_author_firstname();
  37  }
  38  
  39  function get_the_author_lastname() {
  40      global $authordata;
  41      return $authordata->last_name;
  42  }
  43  
  44  function the_author_lastname() {
  45      echo get_the_author_lastname();
  46  }
  47  
  48  function get_the_author_nickname() {
  49      global $authordata;
  50      return $authordata->nickname;
  51  }
  52  
  53  function the_author_nickname() {
  54      echo get_the_author_nickname();
  55  }
  56  
  57  function get_the_author_ID() {
  58      global $authordata;
  59      return $authordata->ID;
  60  }
  61  function the_author_ID() {
  62      echo get_the_author_id();
  63  }
  64  
  65  function get_the_author_email() {
  66      global $authordata;
  67      return $authordata->user_email;
  68  }
  69  
  70  function the_author_email() {
  71      echo apply_filters('the_author_email', get_the_author_email() );
  72  }
  73  
  74  function get_the_author_url() {
  75      global $authordata;
  76      return $authordata->user_url;
  77  }
  78  
  79  function the_author_url() {
  80      echo get_the_author_url();
  81  }
  82  
  83  function get_the_author_icq() {
  84      global $authordata;
  85      return $authordata->icq;
  86  }
  87  
  88  function the_author_icq() {
  89      echo get_the_author_icq();
  90  }
  91  
  92  function get_the_author_aim() {
  93      global $authordata;
  94      return str_replace(' ', '+', $authordata->aim);
  95  }
  96  
  97  function the_author_aim() {
  98      echo get_the_author_aim();
  99  }
 100  
 101  function get_the_author_yim() {
 102      global $authordata;
 103      return $authordata->yim;
 104  }
 105  
 106  function the_author_yim() {
 107      echo get_the_author_yim();
 108  }
 109  
 110  function get_the_author_msn() {
 111      global $authordata;
 112      return $authordata->msn;
 113  }
 114  
 115  function the_author_msn() {
 116      echo get_the_author_msn();
 117  }
 118  
 119  function get_the_author_posts() {
 120      global $post;
 121      $posts = get_usernumposts($post->post_author);
 122      return $posts;
 123  }
 124  
 125  function the_author_posts() {
 126      echo get_the_author_posts();
 127  }
 128  
 129  /* the_author_posts_link() requires no get_, use get_author_link() */
 130  function the_author_posts_link($idmode='') {
 131      global $authordata;
 132  
 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) {
 137      global $wpdb, $wp_rewrite, $post, $cache_userdata;
 138      $auth_ID = $author_id;
 139      $link = $wp_rewrite->get_author_permastruct();
 140  
 141      if ( empty($link) ) {
 142          $file = get_settings('home') . '/';
 143          $link = $file . '?author=' . $auth_ID;
 144      } else {
 145          if ( '' == $author_nicename )
 146              $author_nicename = $cache_userdata[$author_id]->user_nicename;
 147          $link = str_replace('%author%', $author_nicename, $link);
 148          $link = get_settings('home') . trailingslashit($link);
 149      }
 150  
 151      $link = apply_filters('author_link', $link, $author_id, $author_nicename);
 152  
 153      if ( $echo )
 154          echo $link;
 155      return $link;
 156  }
 157  
 158  // Get author's preferred display name
 159  function get_author_name( $auth_id ) {
 160      $authordata = get_userdata( $auth_id );
 161  
 162      return $authordata->display_name;
 163  }
 164  
 165  function wp_list_authors($args = '') {
 166      if ( is_array($args) )
 167          $r = &$args;
 168      else
 169          parse_str($args, $r);
 170  
 171      $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true,
 172          'feed' => '', 'feed_image' => '');
 173      $r = array_merge($defaults, $r);
 174      extract($r);
 175  
 176      global $wpdb;
 177      // TODO:  Move select to get_authors().
 178      $query = "SELECT ID, user_nicename from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> 'admin' " : '') . "ORDER BY display_name";
 179      $authors = $wpdb->get_results($query);
 180  
 181      foreach ( $authors as $author ) {
 182          $author = get_userdata( $author->ID );
 183          $posts = get_usernumposts($author->ID);
 184          $name = $author->nickname;
 185  
 186          if ( $show_fullname && ($author->first_name != '' && $author->last_name != '') )
 187              $name = "$author->first_name $author->last_name";
 188  
 189          if ( !($posts == 0 && $hide_empty) )
 190              echo "<li>";
 191          if ( $posts == 0 ) {
 192              if ( !$hide_empty )
 193                  $link = $name;
 194          } else {
 195              $link = '<a href="' . get_author_link(0, $author->ID, $author->user_nicename) . '" title="' . sprintf(__("Posts by %s"), wp_specialchars($author->display_name)) . '">' . $name . '</a>';
 196  
 197              if ( (! empty($feed_image)) || (! empty($feed)) ) {
 198                  $link .= ' ';
 199                  if (empty($feed_image))
 200                      $link .= '(';
 201                  $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
 202  
 203                  if ( !empty($feed) ) {
 204                      $title = ' title="' . $feed . '"';
 205                      $alt = ' alt="' . $feed . '"';
 206                      $name = $feed;
 207                      $link .= $title;
 208                  }
 209  
 210                  $link .= '>';
 211  
 212                  if ( !empty($feed_image) )
 213                      $link .= "<img src=\"$feed_image\" border=\"0\"$alt$title" . ' />';
 214                  else
 215                      $link .= $name;
 216  
 217                  $link .= '</a>';
 218  
 219                  if ( empty($feed_image) )
 220                      $link .= ')';
 221              }
 222  
 223              if ( $optioncount )
 224                  $link .= ' ('. $posts . ')';
 225  
 226          }
 227  
 228          if ( !($posts == 0 && $hide_empty) )
 229              echo "$link</li>";
 230      }
 231  }
 232  
 233  ?>

Your comment here...

Name: Location:
Comments:


List: Classes | Functions | Variables | Constants | Tables

Generated: Sat Jul 15 11:57:04 2006 Courtesy of Taragana