• This hack shows the authors of your weblog

    function get_authors($postCount = true, $excludeAdmin = true) {
    global $tableusers, $tableposts, $wpdb, $author;
    echo "<div id='authors'>";
    echo "

      ";
      $query = "SELECT ID, user_nickname from $tableusers " . ($excludeAdmin ? "WHERE user_nickname <> 'admin' " : '') . "ORDER BY user_nickname";
      $res = $wpdb->get_results($query);
      foreach($res as $data) {
      $posts = ($postCount ? $wpdb->get_var("SELECT count(*) FROM $tableposts WHERE post_author=$data->ID") : 0);
      echo "

    • " . (@($data->ID == $author) ? $data->user_nickname : "ID\">$data->user_nickname".($posts ? " ($posts)" : '')."") . '
    • ' ;
      }
      echo "

    ";
    echo "</div>";
    }

    The function call could look like this: <?php get_authors(false, true); ?>
    It works with Soarian 1.0.1
    For a demo take a look at blog.lennartgroetzbach.de

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter lennart

    (@lennart)

    Promised, I will add the user pref display in the hack this weekend.
    spiker: Put this in your index.php at the end where the search is and everything else and copy the get_authors.php stuff in your my_hacks.php

    <li><h2>Personen</h2>
    		<?php get_authors(false); ?>
    	</li>

    I’m new at this. But just a question, can I put the function call (function signature) anywhere in index.php? or is there a specific line for this? Again, thanks.

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘get authors’ is closed to new replies.