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 the forum (Today or last 24 hours). (https://vborg.vbsupport.ru/showthread.php?t=82769)

Andreas 09-04-2005 04:47 PM

Code optimization (?) suggest:

forumhome_complete
PHP Code:

// ############### Paul M - Who has visited today v3.31 #################
$vbulletin->templatecache['forumhome_loggedinuser'] = str_replace('href=''title=\"$wrdate\" href='$vbulletin->templatecache['forumhome_loggedinuser']);
$tnow date('YmdHis',TIMENOW $vbulletin->options['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 $vbulletin->db->query_read("
    SELECT userid, usergroupid, membergroupids, lastactivity, options, username FROM " 
TABLE_PREFIX "user
    WHERE lastactivity > 
$cutoff ORDER BY username
"
); 

$totaltoday 0;
while (
$loggedin $vbulletin->db->fetch_array($todaysusers))
{
    
$totaltoday++;

    if (
fetch_online_status($loggedin))
    {
        
$loggedin['musername'] = fetch_musername($loggedin);
        
$wrdate vbdate($vbulletin->options['timeformat'], $loggedin['lastactivity']);
        eval(
'$whotoday .= ", ' fetch_template('forumhome_loggedinuser') . '";');
    }
}
unset(
$loggedin);
$whotoday substr($whotoday2); 
$db->free_result($todayusers);
// ############# End of Who has visited today ############### 


BamaStangGuy 09-04-2005 05:19 PM

Why change from start to complete?

When I use that code it still shows the number of people that vistsed today correctly, but it only lists me by username and no one else.

Ex. Total Users Visited Today: 121

and I am the only one listed, no one else.

Andreas 09-04-2005 05:21 PM

PHP Code:

$vbulletin->templatecache['forumhome_loggedinuser'] = str_replace('href=''title=\"$wrdate\" href='$vbulletin->templatecache['forumhome_loggedinuser']); 

That's the Reason.

BamaStangGuy 09-04-2005 05:22 PM

Quote:

Originally Posted by KirbyDE
PHP Code:

$vbulletin->templatecache['forumhome_loggedinuser'] = str_replace('href=''title=\"$wrdate\" href='$vbulletin->templatecache['forumhome_loggedinuser']); 

That's the Reason.

Edited my post with feedback on the change

evesve 09-04-2005 06:00 PM

Quote:

Originally Posted by evesve
Is there a code so I can get the visitor in order:
Administrators(6), Moderators(7), Special members(9) and than the others?

I?ll try again....

I change the code in the plugin to:
Code:

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 usergroupid, username
");

now I see the users order by usergroups.
There must be an easy way to set the usergroups in order 6,7,9,2,1
??????????????

Paul M 09-04-2005 09:08 PM

Quote:

Originally Posted by KirbyDE
Code optimization (?) suggest:

forumhome_complete

What you have to remember is that my hacks are written for Cable Forum and released here afterwards simply to share them - they run the way they do mostly for specific reasons - and this runs on forumhome_start for a reason. :)

I guess it also depends on what you mean by 'optimization' - using those functions may reduce the code in the hack slightly, but the functions themselves have a lot of code in them, much of which is not necessary to this hack. It is also generic code I use elsewhere, and would require me to load things like functions_bigthree.php.

So, while I thank you for your suggestion - I don't intend to make any changes atm - but I will look at it to see if any of your changes/ideas would suit me in the future, especially when I convert my hacks from plugins to products (at which point I will phrase them as well) - in fact you are the second person to use a trick which I indend to look at to avoid the template edit. :up:

@BrentWilson - while you are free to use the above suggestion - I will not support it, as it's not my code - sorry.

Paul M 09-04-2005 09:09 PM

Quote:

Originally Posted by evesve
There must be an easy way to set the usergroups in order 6,7,9,2,1

Feel free to suggest one. :)

BamaStangGuy 09-04-2005 09:21 PM

Quote:

Originally Posted by Paul M
What you have to remember is that my hacks are written for Cable Forum and released here afterwards simply to share them - they run the way they do mostly for specific reasons - and this runs on forumhome_start for a reason. :)

I guess it also depends on what you mean by 'optimization' - using those functions may reduce the code in the hack slightly, but the functions themselves have a lot of code in them, much of which is not necessary to this hack. It is also generic code I use elsewhere, and would require me to load things like functions_bigthree.php.

So, while I thank you for your suggestion - I don't intend to make any changes atm - but I will look at it to see if any of your changes/ideas would suit me in the future, especially when I convert my hacks from plugins to products (at which point I will phrase them as well) - in fact you are the second person to use a trick which I indend to look at to avoid the template edit. :up:

@BrentWilson - while you are free to use the above suggestion - I will not support it, as it's not my code - sorry.

I realize that I was giving feedback to Kirby on his code.

I am still using yours.

Paul M 09-04-2005 10:09 PM

Quote:

Originally Posted by BrentWilson
I realize that I was giving feedback to Kirby on his code.

I am still using yours.

Ah okay, my misunderstanding, sorry. :)

BamaStangGuy 09-05-2005 12:51 AM

Quote:

Originally Posted by Paul M
Ah okay, my misunderstanding, sorry. :)

Not a problem man :)


All times are GMT. The time now is 08:07 AM.

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.01551 seconds
  • Memory Usage 1,768KB
  • 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
  • (3)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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