Shoutbox refresh keeping user(s) logged in?

AppleBag - February 15, 2009 - 11:31
Project:Shoutbox
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I have at least 1 user that I know of (who is on a dsl connection, I am not sure if that factors into it) who doesn't manually logout, and since I have my shoutbox set to refresh every 60 seconds, it is counting as an "action on the site", which keeps the user marked as online, forever.

I have the Who's Online avatar block installed, and I can watch the user moving around as if he were live on the site, and when I look at the tracker/page visits for the user, it shows, for every 60 seconds, this:

View Shouts
shoutbox/js/view

Is there:

a) a way to get this to stop happening, while still keeping my shoutbox set to refresh once per minute? And ..

b) a way to NOT have that logged in the tracker once per minute? It clogs up the tracker and I would also imagine the database.

TIA

#1

disterics - February 25, 2009 - 07:51

http://drupal.org/node/247889 tracks the problem with shoutbox cloggging the tracker because of refreshes.

Not sure about it keeping the user logged in. I can't promise a fix in the next release but I will look around to see if it will be an easy fix.

#2

AppleBag - February 26, 2009 - 05:53

Thanks,

Well, I'm pretty sure this hack won't address the keeping the user logged in since it just filters out the Shout Views from the tracker, but it's a nice start. For anyone interested here is the modification I did to the Statistics.module (D5):

Search for this code (which should be on or around line 239):

while ($log = db_fetch_object($result)) {

just below it, add:

    // Hack by Scott Elblein - Filters out the "View Shouts" addition to the tracker, which clutters up the log.
    if ($log->title != 'View Shouts') {

Then, below this line:

l(t('details'), "admin/logs/access/$log->aid"));

add the closing curly brace. }

The result is, it will show all other events, excluding the View Shouts event.

#3

random4t4x14 - April 30, 2009 - 10:36

will this hack work in d6?

#4

burmistrow - March 1, 2010 - 12:18

+1
what need to modify for cutout that messages from log in D6

#5

AppleBag - March 8, 2010 - 00:07

Sorry guys, I don't have D6 installed, so I can't take a look to see for myself.

#6

burmistrow - March 11, 2010 - 18:41

That what i understood.
AppleBag, you have changed statistics_user_tracker()

   229  function statistics_user_tracker() {
   230    if ($account = user_load(array('uid' => arg(1)))) {
   231
   232      $header = array(
   233          array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
   234          array('data' => t('Page'), 'field' => 'path'),
   235          array('data' => t('Operations')));
   236
   237      $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d' . tablesort_sql($header), 30, 0, NULL, $account->uid);
   238      while ($log = db_fetch_object($result)) {
   239        $rows[] = array(
   240          array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
   241          _statistics_format_item($log->title, $log->path),
   242          l(t('details'), "admin/logs/access/$log->aid"));
   243      }
   244
   245      drupal_set_title(check_plain($account->name));
   246      $output = theme('table', $header, $rows);
   247      $output .= theme('pager', NULL, 30, 0);
   248      return $output;
   249    }
   250    else {
   251      drupal_not_found();
   252    }
   253  }

i have found the same code in D6 at file /modules/statistics/statistics.pages.inc
    42  function statistics_user_tracker() {
    43    if ($account = user_load(array('uid' => arg(1)))) {
    44
    45      $header = array(
    46          array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'),
    47          array('data' => t('Page'), 'field' => 'path'),
    48          array('data' => t('Operations')));
    49
    50      $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d'. tablesort_sql($header), 30, 0, NULL, $account->uid);
    51      $rows = array();
    52      while ($log = db_fetch_object($result)) {
    53        $rows[] = array(
    54          array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
    55          _statistics_format_item($log->title, $log->path),
    56          l(t('details'), "admin/reports/access/$log->aid"));
    57      }
    58
    59      if (empty($rows)) {
    60        $rows[] = array(array('data' => t('No statistics available.'), 'colspan' => 3));
    61      }
    62
    63      drupal_set_title(check_plain($account->name));
    64      $output = theme('table', $header, $rows);
    65      $output .= theme('pager', NULL, 30, 0);
    66      return $output;
    67    }
    68    else {
    69      drupal_not_found();
    70    }
    71  }

insert hack after line 52
      while ($log = db_fetch_object($result)) {
the code
if ($log->title != 'View Shouts') {
l(t('details'), "admin/reports/access/$log->aid"));
}

anybody say me will that work, i'm newbee in drupal and php.

#7

burmistrow - March 11, 2010 - 21:25

error too many ")" at the end, erase one of em and leave

if ($log->title != 'View Shouts') {
l(t('details'), "admin/reports/access/$log->aid");
}

But nothimg chage, View Shouts left in reports

 
 

Drupal is a registered trademark of Dries Buytaert.