Author/Memberlist of avatars – how to?
-
hey guys,
I’ve been trying for a few days to get a member/author list that is only made up of author’s avatars – no text. The image is a link to their profile.
Most authors have yet to have an avatar. So I have used an if/then statement to say “if the avatar exists use it, otherwhise use this other default one”
I tried using file_exists – but it didn’t work. Then I stumbled across the OBJECT tag and using an alternate image if the first one doesn’t exist.
Anyway – it is SUPER SLOW.
Oh yeah, and Safari can’t load the page properly – only Firefox seems to spit it out ok.Our phpbb2 forums memberlist is really fast to load.
So…
Any ideas how I can create this “Avatar Authorlist” page?
I am using Dan’s Avatar thingy as the avatar tool – cheers Dan ??
If anyone can give me some ideas that would be great.
I am putting this site together so I can move our phpbb forum to wordpress/bbforums – so I want to add some newer cooler tools – so the site is a bit ugly
Cheers!
Adam
Here is my attempt at the page (using pieces of other people’s code):
<?php
/*
Template Name: MembersByAvatar
*/
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn">
<h2>Authors</h2>
<table>
<tr>
<th>
<?php
global $wpdb, $table_prefix; // set global WP vars needed for script
$order = 'user_login'; // set order for users table query
$user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY $order"); // query users
foreach($user_ids as $user_id) : // start authors' profile "loop"
$user = get_userdata($user_id); // retrieve author (i.e. user) details
?>
<?php
$image_dir = '../wp-content/avatars'; // directory where author images reside
$image_file = $user->ID; // format for image name
$image_ext = 'jpg'; // author image extension
$image_path = trim($image_dir, '/') . '/' . $image_file . '.' . $image_ext;
?><a href="https://blog.lumanation.com?author=<?php echo $user->ID ?>"><OBJECT DATA="<?php echo $image_path; ?>" TYPE="image/png" TITLE="Avatar" ></a>
<a href="https://blog.lumanation.com?author=<?php echo $user->ID ?>"><OBJECT DATA="https://blog.lumanation.com/wp-content/avatars/no_avatar.jpg" TYPE="image/png" TITLE="No Avatar" ></a>
</OBJECT>
</OBJECT><?php
endforeach; // end of authors' profile 'loop'
?>
</th>
</tr>
</table>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
- The topic ‘Author/Memberlist of avatars – how to?’ is closed to new replies.