Last updated September 12, 2008. Created on November 13, 2007.
Edited by Wolfflow, LeeHunter, NancyDru. Log in to edit this page.

I used the Profile module to add a multi-line field called "Interests," and a URL field called "My Web Site or Biography Link." There are also fields for first and last names, city, state, and zip codes. There are check boxes for those who are in associated groups. This page also includes the user's picture if they loaded one.

I create a simple table (see this article). The user's web site link is a bit smaller than normal text, but includes target="_blank" so your users stay on your site.

Note that there are a lot of checks for missing data as it is like pulling teeth to get people to enter it. Also, I'm not using the t() function on the strings, because this example is for an English-only group.

This page is intended to give you an introduction to the members of xxx. The information is filled in by the members themselves in their "My Account" page. In order to appear on this list you must have logged in on this site at least once.

<?php
echo '<div class="bios"><h3 align="center">xxx Member Biographies</h3>';
$show_blocked = FALSE;

$header = array(
  array(
'data' => t('Name')),
  array(
'data' => t('Location')),
  array(
'data' => t('Member since')),
  array(
'data' => t('Interests/Bio'))
   );
$sql = "SELECT u.uid, u.name FROM {users} u WHERE u.uid>1 ORDER BY u.name";
$sql .= tablesort_sql($header);
$result = pager_query($sql, 100);
$rows = array();

while (
$account = db_fetch_object($result)) {
 
$account = user_load(array('uid' => $account->uid));
  if (!
in_array('Members', $account->roles)) { continue; }
  if (
$account->uid > 1) {
     if (
$account->picture){$account->picture = '<img src="/'.$account->picture.'" height="100" width="100"  alt="'.$account->name.'">';}
     else {
$account->picture = '<img src="/files/pictures/bodYou.gif" height="100" width="100" border="0" alt="no picture found">';}
    if (
$account->profile_firstname) { $fullname = $account->profile_firstname . " " . $account->profile_lastname; }
    else {
$fullname = $account->name . ' ???'; }
   
$userlink = l($fullname, 'user/'. $account->uid);

    if (
$account->profile_interests) {$interests = $account->profile_interests;}
    else {
$interests = "No biography provided";}
   
$member = array();
    if (
$account->profile_hs_member) { $member[] = 'Horiticultural Society'; }
    if (
$account->profile_gc_member) { $member[] = 'Garden Club'; }
    if (
count($member) > 0) {
      
$interests .= '<br />'. "I'm a member of the ". implode(' and ', $member);
     }

    if (
$account->profile_biolink) {$interests .= '<br/><small><a href="' . $account->profile_biolink
                                          
. '" target="_blank">' . $fullname . "'s web site</a></small>";}
    if (
$account->profile_city) {$location = $account->profile_city . ", "
                                  
. $account->profile_state . " " . $account->profile_zip;}
    else {
$location = "No location provided";}
  
$status_ind = $account->status ? '': '<br/><small>Inactive</small>';
  
$x = $account->profile_date_joined['month'] . $account->profile_date_joined['day'] .                            $account->profile_date_joined['year'];

   if (
$account->profile_date_joined) {
    
$d_str = date('F Y', mktime(0, 0, 0, $account->profile_date_joined['month'],
                                       
$account->profile_date_joined['day'],
                                       
$account->profile_date_joined['year']));
   }
   else {
$d_str = '? ? ?'; }
   if (
$account->status || $show_blocked) {
    
$rows[] = array($userlink . "<br/>" . $account->picture . $status_ind,
                    
'<small>' . $location . '</small>',
                    
$d_str,
                    
$interests
                   
);
    }
/* end account_status */
 
}
}

echo
theme('table', $header, $rows) . '</div>';
?>

 

Note:

Just copy-paste the "code" above it into a new "page" (node) as an admin. Use input format "php code". Then display the node with another logged in user.

You may change the line:
if (!in_array('Members', $account->roles)) { continue; }
to :
if (!in_array('authenticated user', $account->roles)) { continue; }
if you have no "Members" role by default in your fresh Drupal 5.7 install,
and line:
else { $d_str = '? ? ?'; }
to:
else { $d_str =date(r,$account->created); }

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.