Display joining date on Who's new block.

admin's picture
in

You will have to hack the user.module for this. So be careful while you upgrade.

Find this place at around line 570 in user.module (in function user_block):

<?php
case 2:
if (user_access('access content')) {
// Retrieve a list of new users who have subsequently accessed the site successfully.
$result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, 5);
while ($account = db_fetch_object($result)) {
$items[] = $account;
}
$output = theme('user_list', $items);

$block['subject'] = t('Who\'s new');
$block['content'] = $output;
}
return $block;
?>

And change these three lines:

<?php
$result = db_query_range('SELECT uid, name FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, 5);

//Change to grab the created variable which stores the user's creation timestamp:

$result = db_query_range('SELECT uid, name, created FROM {users} WHERE status != 0 AND access != 0 ORDER BY created DESC', 0, 5);
?>

<?php
$items[] = $account;

//Change to make each $items be a link to the user's profile page with the timestamp formatted:

$items[] = l($account->name . date(" n-d-y", $account->created), "/user/$account->uid");
?>

<?php
$output = theme('user_list', $items);

//Change to output an item list instead of a user list (which is really an item list that makes the same links we just made above based on a name/uid array:

$output = theme('item_list', $items);
?>

Contributed by rszrama http://drupal.org/user/49344


's points

Points are visible to logged in users only

descriptionvalue
Members2246
Posts217
Comments112
Reads today
Reads all time
Hits today0