The User Visits Module [1] is a module for the exciting Drupal Web Content Management System [2]. Very lighweight and simple, it just remembers the users who visited another user's profile page.

If you want to customize the user profile layout [3] with the technique described on drupal.org, you may display the user's visitors with the following code
<?php
$visitors = user_visits_latest($user->uid);
if (is_array($visitors)) {
foreach ($visitors as $visitor) {
$user = user_load(array('uid' => $visitor->vuid));
$output = theme('user_visit', $user, $visitor->visit);
}
}
?>And you also may override the themeable function, by placing it in your template.php. Modify it to your liking.
<?php
function phptemplate_user_visit($user, $timestamp = NULL) {
$output = "<div class=\"profile\">\n";
$output .= theme('user_picture', $user);
$output .= ' <div class="name">'. theme('username', $user) ."</div>\n";
if ($timestamp) {
$output .= " <div class=\"visit\">". t('!time ago', array('!time' => format_interval(time() - $timestamp))) ."</div>\n";
}
$output .= "</div>\n";
return $output;
}
?>Weblinks
[1] http://drupal.org/project/user_visits
[2] http://drupal.org
[3] http://drupal.org/node/35728
Post new comment