All pastes #271872 Raw Edit

Stuff

public text v1 · immutable
·published 2006-12-08 14:55 UTC
rendered paste body
<?php get_header();?>
<div id="content">
<div id="content-main">
<?php
    /*
    Set the $order variable to whatever you want to sort the authors'
    list on. You can use any users table column name; examples are:
    'ID', 'user_nicename', 'user_login', 'user_url', 'display_name',
    and 'dateYMDhour' (registration date).
    */
?>
<?php
    global $wpdb, $table_prefix; // set global WP vars needed for script

    $order = 'user_nicename'; // 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
    $level = $table_prefix . 'user_level'; // set 'user_level' usermeta meta_key record
    $user->user_level = $user->$level; // assign 'user_level' property to $users
    $role = $table_prefix . 'capabilities'; // set 'role' usermeta table meta_key record
    $user->role = array_keys($user->$role); // assign 'role' property to $user
    $user->role = $user->role[0]; // make sure $user->role is not an array
?>
<?php
    /*
    This is the authors' profile 'loop'. It displays info from the
    profile for every author, along with a few bits of other author-
    related data. Feel free to add, subtract, change layout; whatever
    you'd like.

    These 'tags' will display "publically accessable" user info; what
    is displayed by each is hopefully self-explanatory:

        <?php echo $user->aim; ?>
        <?php echo $user->description; ?>
        <?php echo $user->display_name; ?>
        <?php echo $user->first_name; ?>
        <?php echo $user->jabber; ?>
        <?php echo $user->icq; ?>
        <?php echo $user->ID; ?>
        <?php echo $user->last_name; ?>
        <?php echo $user->msn; ?>
        <?php echo $user->nickname; ?>
        <?php echo $user->role; ?>
        <?php echo $user->user_email; ?>
        <?php echo $user->user_level; ?>
        <?php echo $user->user_login; ?>
        <?php echo $user->user_nicename; ?>
        <?php echo $user->user_registered; ?>
        <?php echo $user->user_url; ?>
        <?php echo $user->yim; ?>
    */
?>
<?
    /*
    if(('admin' != $user->user_login) && ($user->wp_user_level > 0)) :
    Tests for accounts that are not 'admin' or above 'subscriber' role.

    To display the admin account, comment out or remove the first 'if'
    line and uncomment the one right after it.

    The additional variations for the if statement listed below can be
    used if you want to check whether the user is assigned the role of
    'author', or author/contributor.

    Default roles you can work with here are:

        subscriber
        contributor
        author
        editor
        administrator

    If you're using a plugin that lets you create custom roles, these
    should work with it as well.

    Finally, if you want to display absolutely every user on your blog,
    use something like:

        if( $user->user_login ) :

    */
?>
<?php
    //    if( ('admin' != $user->user_login) && ($user->user_level > 0) ) :
    if( $user->user_level > 0 ) : // show all users above the role of 'subscriber'
    //    if( $user->role == 'author' ) : // show only users with a role of 'author'
    //    if( ($user->role == 'author') || ($user->role == 'contributor') ) : // show users with role of 'author' or 'contributor'
?>

<h2 id="user-<?php echo $user->ID; ?>" class="author-profile"><?php echo $user->first_name; ?> <?php echo $user->last_name; ?>'s Blog</h2>

<?php $top_query = new WP_Query('showposts=1'); ?>

<?php while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID; ?>

<div class="post" id="post-<?php the_ID(); ?>">
	<div class="pagetitle">
		<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
		<p class="post-info"><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> </p>
	</div>
				
	<div class="entry">
		<?php the_content(); ?>
	</div>
		
	<p class="postmetadata"><a href="<?php the_permalink() ?>">read more</a> - <?php edit_post_link('edit', '', ' - '); ?> <?php comments_popup_link('no comments &#187;', '1 comment &#187;', '% comments &#187;'); ?><br><br>
	Categories: <?php the_category(', ') ?></p>
</div>

<?php endwhile; ?>

<ul class="authorposts">
<!-- The Loop -->
			<?php if ( have_posts($user->ID) ) : while ( have_posts($user->ID) ) : the_post($user->ID); ?>
			<?php if (!($first_post == $post->ID)) : ?>
			<li>
				<p>
				<?php the_time('d M Y'); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a>
				</p>
			</li>
			<?php endif; ?>
			<?php endwhile; else: ?>
			<p><?php _e('No posts by this author.'); ?></p>

			<?php endif; ?>
<!-- End Loop -->
</ul>

<?php
    endif; // end of admin and user_level test
    endforeach; // end of authors' profile 'loop'
?>
</div>
<?php get_sidebar();?>
<?php get_footer();?>