Hi
I have created a template from a tutorial (http://wpsplash.com/how-to-create-a-wordpress-authors-page/) but I have a problem with it. For some reason it is listing users that are not authors!
Does anyone know if there is something wrong with the code?
This is the code from the template (authors.php)
<?php
$authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);if($authors):foreach($authors as $author):
?>
<div class='author' id='author-<?php the_author_meta('user_login', $author->post_author); ?>'>
<div class="connect"><h3><strong>Writer Name: </strong>
<?php the_author_meta('display_name', $author->post_author); ?></h3></div>
<?php if(get_the_author_meta('description', $author->post_author)): ?>
<div class='description'><strong>Writer Bio:</strong></div>
<div class='description'>
<?php echo get_avatar(get_the_author_meta('user_email', $author->post_author), 80); ?>
<p><?php the_author_meta('description', $author->post_author); ?></p>
</div>
<?php endif; ?>
<?php
$recentPost = new WP_Query('author='.$author->post_author.'&showposts=1');
while($recentPost->have_posts()): $recentPost->the_post();
?>
<h4><strong>Latest Post:</strong> <a href='<?php the_title();?>'><?php the_title(); ?></a> <br /><strong>All Posts by</strong> <a href="<?php bloginfo('url'); ?>/author/<?php the_author_meta('user_login', $author->post_author); ?>"><?php the_author_meta('display_name', $author->post_author); ?></a></h4>
<?php endwhile; ?>
<?php if(get_the_author_meta('twitter', $author->post_author) || get_the_author_meta('facebook', $author->post_author) || get_the_author_meta('linkedin', $author->post_author) || get_the_author_meta('digg', $author->post_author) || get_the_author_meta('flickr', $author->post_author)): ?>
<ul class='connect'>
<?php if(get_the_author_meta('twitter', $author->post_author)): ?>
<li><a href='http://twitter.com/<?php the_author_meta('twitter', $author->post_author); ?>'>Follow me on Twitter</a></li>
<?php endif; ?>
<?php if(get_the_author_meta('facebook', $author->post_author)): ?>
<li><a href='http://www.facebook.com/<?php the_author_meta('facebook', $author->post_author); ?>'>View my Facebook Page</a></li>
<?php endif; ?>
<?php if(get_the_author_meta('youtube', $author->post_author)): ?>
<li><a href='http://www.youtube.com/<?php the_author_meta('youtube', $author->post_author); ?>'>YouTube Channel</a></li>
<?php endif; ?>
<?php if(get_the_author_meta('digg', $author->post_author)): ?>
<li><a href='http://digg.com/users/<?php the_author_meta('digg', $author->post_author); ?>'>Digg</a></li>
<?php endif; ?>
<?php if(get_the_author_meta('flickr', $author->post_author)): ?>
<li><a href='http://www.flickr.com/photos/<?php the_author_meta('flickr', $author->post_author); ?>/'>Flickr</a></li>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>
<?php endforeach; endif; ?>
</div>
Thanks for any help 🙂