Download & Extend

Shoutbox refresh keeping users logged in, filling tracker log

Project:Shoutbox
Version:6.x-2.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

Comments

#1

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

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

will this hack work in d6?

#4

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

#5

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

#6

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

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

#8

subscribe, thx

#9

Is this something we want looked at for the 6.x branch?

#10

definitely for 6.x thx !

#11

If anyone has a solution that doesn't involve hacking core, I'd love to know..

I noticed this annoying issue too..

#12

Version:5.x-1.x-dev» 6.x-2.x-dev

A solution is not to use Drupal menu system, but use a separate PHP file for the shoutbox update with a minimal db usage (include directly the Drupal settings.php, bypass all bootstrap process).

#13

Another module that does this is Chatroom - there is a custom chatroom.php file that is hit, which allows a bypassing of core statistics/tracker, and for less db overhead when reading from the chat room table.

I would suggest Shoutbox take the same approach, for scalability...

#14

Title:Shoutbox refresh keeping user(s) logged in?» Shoutbox refresh keeping users logged in, filling tracker log

Updating title, marked #247889: View Shouts in log! as a duplicate.

#15

Category:support request» feature request

#16

subscribe

#17

Status:active» postponed (maintainer needs more info)

I don't think having a separate shout.php would work with how shoutbox is currently set up. Submodules depend on altering the ajax callback path, then using that path to determine group context, user context, etc. That wouldn't be possible with a separate php file.

Any ideas?

#18

Status:postponed (maintainer needs more info)» active

With one shoutbox.php you can have multiple paths: shoutbox.php?path=1 or shoutbox.php?path=2...

nobody click here