Hi there,
I'm coming up completely blank on how to add a little more customisation to a site I'm helping a friend with.
The site is a record label, and I've worked out a system to get all the artists listed on a single page, however the only way I can work out to order this list of artists is alphabetically as I'm querying the wp_users table (I assume) and there are no customisable database columns that I could alter herein.
I have a feeling I need to merge data from the wp_usermeta table, this might allow me to use the AIM meta field as a pseudo "Order" field.
A condensed version of the code I'm using to display this author list is below, and a sample of the page I'm applying this to is over at:
http://devel.invisibleagent.com/artists/
<ul id="artist-list">
<?php
global $wpdb, $table_prefix; // set global WP vars needed for script
$order = 'display_name'; // set order for users table query
$user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY $order DESC"); // query users
// Start Author Profile Loop
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
if( ($user->role == 'author') || ($user->role == 'contributor') ) : // show users with role of 'author' or 'contributor'
$image_dir = 'wp-content/uploads/userphoto'; // directory where author images reside
// The image file name will always be lowercase, so we need to ensure that the user_login is lowercase as well
$image_file = preg_replace('/\ /', '-', strtolower($user->user_login));
$image_ext = 'jpg'; // author image extension
$image_path = trim($image_dir, '/') . '/' . $image_file . '.' . $image_ext;
if(file_exists(ABSPATH . $image_path)) :
$author_image = get_bloginfo('home') . '/' . $image_path;
?>
<li class="artist-box">
<p><a href="<?php get_author_link(true, $user->ID, "$user->user_nicename"); ?>"><img class="artist-image" src="<?php echo $author_image; ?>" alt="<?php echo $user->nickname; ?>" title="Photo of <?php echo $user->nickname; ?>" /></a></p>
<p class="artist-name"><a href="<?php get_author_link(true, $user->ID, "$user->user_nicename"); ?>"><?php echo $user->nickname; ?></a></p>
</li>
<?php endif; ?>
<?php
endif; // end of admin and user_level test
endforeach; // end of authors' profile 'loop'
?>
</ul><!-- #artist-list -->
Any thoughts on how to crack this would be fantastic!