Latest Users

Wyze1 - February 7, 2008 - 07:20

Hi guys

I need assistance with the following. I'm trying to display a my websites latest user and I need to display the user pictre, firstname and lastname

In the following format:

picture
firstname | lastname

Does anybody know if there is a snippet for this?

For the who's online block,

gpk - February 7, 2008 - 11:51

For the who's online block, user_block() http://api.drupal.org/api/function/user_block/5 calls theme('user_list', $items, t('Online users')), where $items is an array of user objects (only uid and name populated).

theme_user_list() is here http://api.drupal.org/api/function/theme_user_list/5.

This calls theme('username', $user). You may not want to override http://api.drupal.org/api/function/theme_username/5 since this is used elsewhere in Drupal.

So I suggest you implement phptemplate_user_list() in your theme's template.php, based on theme_user_list(), but instead of calling theme('username', ...), write your own code to outpt it the way you want, i.e. something like

<?php
// Load full user object
$user = user_load(array('uid' => $user->uid));
// Individual user properties are available as $user->property
// Use print_r($user) to see what's available
// Use theme('user_picture', $user) to output the user's picture
...
?>

gpk
----
www.alexoria.co.uk

 
 

Drupal is a registered trademark of Dries Buytaert.