I've enabled it and also enabled both adv blocks. Only one block shows up, the My Visitor History Adv one. My recent visitors adv doesn't show up at all, and the block for Visitor history only shows this in plain text:

My Visitor History
1 views in total
history: 1 0 0 0 0

I've also had alot more than just one visit, and from multiple visitors.

Also a side question, how do I get it themed like in the screenshot? Is there some code already available so I don't have to write it from scratch?

tia

Comments

toemaz’s picture

Hi Tia,

This module is working as advertised. Only after your cron has run, the user visits data is updated.

The only thing you need to do, is theme the block output. Here is an example of user_visits_adv_history.tpl.php which works together with the chart module:

  $output = '';
  
  if (module_exists('chart')) {
    $chart = array(
      '#chart_id' => 'user_visits_chart',
      '#type' => CHART_TYPE_LINE,
      '#data' => $history,
      '#adjust_resolution' => (max($history) ? TRUE : FALSE),
      '#size' => chart_size(100, 50),
      '#bar_size' => chart_bar_size(0, 0),
    );
    
    // fix to get the ls chart type which is not implemented in the D5 release of the chart module
    $output .= str_replace(array('lc', '-1'), array('ls', '0'), chart_render($chart));
  }
  
  $output .= '<div id="user-visits-stats">' .
    t('!visits today', array('!visits' => array_pop($history))) . '<br/>' . 
    t('!visits all time', array('!visits' => $total)) . 
    '</div>';
  
  print $output;
AppleBag’s picture

Hi

Thanks for the reply. I'm still not sure I'm understanding. I just installed the chart module and enabled it. And created the .tpl.php file and placed the code in it, saving it to my site's theme (garland) (did I do that right?), emptied the site cache, and it was all still the same. I have already been running it for a few days and i have gotten many profile views for it to log some data during the chron runs, but still the same.

One interesting thing though that just happened, after doing what I just mentioned, I manually ran the chron and I got this error:

Fatal error: Unsupported operand types in /home/www/foobar.com/sites/all/modules/user_visits_adv/user_visits_adv.module on line 217

Maybe this is the problem?

toemaz’s picture

The problem you mentioned at the end is something which will be unrelated with the theming question. Since you filed this issue under D5, don't forget you need to adjust template.php file as well, in the default normal way to include a tpl.php file.

Regarding your issue: could you add 2 lines in the code before line 217?

        print('Visitors array:');
        print_r($visitors);
        $visit->recent_visitors += $visitors;

When you run cron again manually, do you see some output?

AppleBag’s picture

Hi, after adding the 3 lines of code you gave, just before line 217, this is all that is shown when I run chron:

Visitors array:
Fatal error: Unsupported operand types in /home/www/foobar.com/sites/all/modules/user_visits_adv/user_visits_adv.module on line 220

Line 220 is this:
$visit->recent_visitors += $visitors;