Community Documentation

Display (x) last logged in userpictures

Last updated May 26, 2009. Created by peaced on November 6, 2006.
Edited by bekasu. Log in to edit this page.

Display (x) last logged in userpictures

This script show userpictures of the last logged in users. It looks nice and it enhances the community-feeling. It will only show those users who have uploaded a picture. You propably need to adjust $count variable. Also it propably looks better if you have fixed width userpictures. (there is a module for this I think)

<?php
 
//show user pictures ---------------------------
  //Will only show those users who have a picture
 
$count = 9; //how many users in total with or without pictures, edit this value

 
global $user;
   
 
$output = '<BR><TABLE BORDER="0" CELLPADDING="0"  CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#f0f7f0"><center>';

 
$result = db_query_range("SELECT * FROM {users} as u where status=1 AND picture <> '' ORDER BY access DESC",0,$count);


  while (
$user_info = db_fetch_object($result)) {
    
$output .= '<a href="/user/'.$user_info->uid.'">
<img src="/'
.$user_info->picture.'"  hspace=0  height="90" ></a>';
  }

 
$output .= '</center></TD></TR></TABLE>';
 
//------------------------------------------------------
 
print $output;
?>

About this page

Drupal version
Drupal 4.7.x, Drupal 5.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here