Topic: Alternate User List Colors

You'll have to forgive me if this has been asked however I did a search for "user list" and a few variations of that and alternating colors and I didn't come up w/ anything.

I was just curious how can I alternate the row colors of the userlist? I've seen the posts on alternating posts and threads and I have all those working just fine... now all that's left is the user list big_smile. Can anyone hook a brotha up please smile

Re: Alternate User List Colors

You should be able to do a variation of Shaun Inman's method of alternation on index.php, like so:

        $alt = true;
        while ($user_data = $db->fetch_assoc($result))
        {
                $alt = !$alt;
                $user_title_field = get_title($user_data);

?>
                                <tr <?php if($alt) echo 'class="alt"' ?>>
                                        <td class="tcl"><?php echo '<a href="profile.php?id='.$user_data['id'].'">'.pun_htmlspecialchars($user_data['username']).'</a>' ?></td>
                                        <td class="tc2"><?php echo $user_title_field ?></td>
<?php if ($show_post_count): ?>                                        <td class="tc3"><?php echo $user_data['num_posts'] ?></td>
<?php endif; ?>
                                        <td class="tcr"><?php echo format_time($user_data['registered'], true) ?></td>
                                </tr>
<?php

        }

Just replace the existing while loop in userlist.php. I haven't tested to see if it will work, but I believe it will.

Looking for a certain modification for your forum? Please take a look here before posting.