vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Members who have visited today (with last 24 hours option). (https://vborg.vbsupport.ru/showthread.php?t=71533)

Paul M 07-30-2006 11:42 PM

The version for 3.6 was released last week.

https://vborg.vbsupport.ru/showthread.php?t=121883

bornic 04-17-2008 04:27 AM

error on VBulletin 3.6.9 Version

bornic 04-17-2008 04:29 AM

Solve:

Code:

Step 1.

In Index.php ;

Find ;

// ### LOGGED IN USERS #################################################

And insert this code above it ;

// ############### Paul M - Who has visited today v2.31 #################

$tnow = date('YmdHis',TIMENOW - $vboptions['hourdiff']);
$cutoff = TIMENOW - (substr($tnow,8,2)*3600 + substr($tnow,10,2)*60 + substr($tnow,12,2));
//$cutoff = TIMENOW - 86400 ;  // ## Uncomment this line if you want a rolling 24 hours display ## //
$todaysusers = $db->query("SELECT userid, lastactivity, options, username, user.usergroupid, displaygroupid,
groupa.opentag as opentaga, groupa.closetag as closetaga, groupb.opentag as opentagb, groupb.closetag as closetagb
FROM " . TABLE_PREFIX . "user as user
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupa ON(user.usergroupid = groupa.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "usergroup as groupb ON(user.displaygroupid = groupb.usergroupid)
WHERE lastactivity > " .$cutoff. " ORDER BY username" );

$totaltoday = 0;
unset ($whotoday);
while ($today = $db->fetch_array($todaysusers))
{
        $totaltoday += 1;
        $today['opentag'] = $today['opentaga'] ;
        $today['closetag'] = $today['closetaga'] ;
        if ($today['displaygroupid'])
        {
                $today['opentag'] = $today['opentagb'] ;
                $today['closetag'] = $today['closetagb'] ;
        }
        $today[visible] = 1 ;
        if ($today['options'] & $_USEROPTIONS['invisible'])
        {
                $today['visible'] = 0 ;
                if (($permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
                {
                        $today['visible'] = 2 ;
                }
        }
        if ($today['visible'])
        {
              $wrdate = vbdate($vboptions['timeformat'], $today['lastactivity']);
                $whotoday .= "<a href='member.php?u=$today[userid]' title='$wrdate' >";
                if ($today['visible'] == 2)
                {
                        $whotoday .= $today['opentag'].$today['username'].$today['closetag']."</a>*, ";
                }
                else
                {
                        $whotoday .= $today['opentag'].$today['username'].$today['closetag']."</a>, ";
                }
        }
}
if ($whotoday)
{
        $whotoday = substr($whotoday, 0, strlen($whotoday)-2);
}

// ############# End of Who has visited today ###############


Step 2.

In the FORUMHOME Template ;

Find;

<!-- end logged-in users -->


and add after;

<!-- Todays active users -->
<tbody>
        <tr>
                <td class="thead" colspan="2">
                        <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_todayusers')"><img id="collapseimg_forumhome_todayusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_todayusers].gif" alt="" border="0" /></a>
                        Total users that have visited today: $totaltoday
                </td>
        </tr>
</tbody>
<tbody id="collapseobj_forumhome_todayusers" style="$vbcollapse[collapseobj_forumhome_todayusers]">
        <tr>
                <td class="alt2"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="Users online today" border="0" /></td>
                <td class="alt1" width="100%"><div class="smallfont">$whotoday</div></td>
        </tr>
</tbody>
<!-- Todays active users -->


Step 3.

This is optional, but will speed up the query if you have a large number of members;

Run the following SQL query;


ALTER TABLE user ADD INDEX (lastactivity)



All times are GMT. The time now is 03:37 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03236 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete