User Visits Advanced

Component ID

387394

Component name

User Visits Advanced

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

9779

Component created

Component changed

Component body

The User Visits Advanced module is a contrib module for the User Visits module. It is extremely useful for social networking sites who wish to provide their users with statistics about the number of times a the users profile page is being viewed and by which other users. See the provided screen shot how the block of this module can look like.

This module comes with its own database table to store statistics per user profile (uid). At cron time, the data from the user_visits table is collected, aggregated and stored in the user_visits_adv table. It stores

  • the total number of visits per uid
  • the number of visits of the X past days per uid
  • the most recent visitors uids of the past Y hours

Installation

  • Enable the user_visits_adv module
  • Go to admin/user/user_visits and the advanced fieldset
  • You can choose to enable the two blocks: My recent visitors adv & My visitors history adv
  • Configure each block for the amount of data which should be handed over to the theming functions

Theming

The My visitors history adv block can be themed by overriding the following function

/**
 * Theme function for history block
 * @param $history is array with the views data of the past X days.
 * X is defined in the configuration of the block
 * @param $total the total number of views
 */ 
function theme_user_visits_adv_history($history, $total) {
  
  $output = '<div>' . t('!total views in total', array('!total' => $total)) . '</div>';
  $output .= '<div>' . t('history') . ': ' . implode(' ', $history) . '</div>';
  return $output;
}

Development

The Drupal 6 version has been ported by mariusooms.