Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 01-02-2016, 03:36 AM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok good this works, just one small bug .... it still shows one member active from 5 hours ago who is a test account ....

--------------- Added [DATE]1451768165[/DATE] at [TIME]1451768165[/TIME] ---------------

Any update on this Mark as to why it will still show someone logged in from 5,10 and 20 hours ago?

I did notice though that in order for this to consider someone active they have to actually execute something like post a comment, like a comment not just be logged on ....

What other options are there for this, can this display members who are just logged on period? And does it also detect logged in users from Tapatalk? I see that there are members who are online logged in but through tapatalk but are not being displayed on this sidebar block ....

Thank you ahead of time Mark !!!
Reply With Quote
  #22  
Old 01-02-2016, 06:59 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CAG CheechDogg View Post
Ok good this works, just one small bug .... it still shows one member active from 5 hours ago who is a test account ....

--------------- Added [DATE]1451768165[/DATE] at [TIME]1451768165[/TIME] ---------------

Any update on this Mark as to why it will still show someone logged in from 5,10 and 20 hours ago?

I did notice though that in order for this to consider someone active they have to actually execute something like post a comment, like a comment not just be logged on ....

What other options are there for this, can this display members who are just logged on period? And does it also detect logged in users from Tapatalk? I see that there are members who are online logged in but through tapatalk but are not being displayed on this sidebar block ....

Thank you ahead of time Mark !!!
I will have to take a look at a better way to determine which users are actually online.
Reply With Quote
  #23  
Old 01-02-2016, 07:05 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok good stuff my Man .... thank again !!!!
Reply With Quote
  #24  
Old 01-03-2016, 01:19 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, add the following line before the query:

PHP Code:
$timecutoff TIMENOW $vbulletin->options['cookietimeout']; 
And then change the db query to the following:

PHP Code:
$users_online $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    INNER JOIN " 
TABLE_PREFIX "session AS session
    ON session.userid = user.userid
    WHERE user.usergroupid IN (" 
$groupid ")
    " 
$qwhere "
    AND session.loggedin > 0
    AND session.lastactivity >= " 
$timecutoff "
    GROUP BY user.userid
    ORDER BY user.lastactivity DESC
"
); 
Reply With Quote
  #25  
Old 01-03-2016, 02:15 AM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where exactly do I add

PHP Code:
 $timecutoff TIMENOW $vbulletin->options['cookietimeout']; 
Reply With Quote
  #26  
Old 01-03-2016, 02:30 AM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CAG CheechDogg View Post
Where exactly do I add

PHP Code:
 $timecutoff TIMENOW $vbulletin->options['cookietimeout']; 
Anywhere before the db query will be fine.

This is what I now have:

PHP Code:
global $vbulletin$db;
$groupid '6,13';
$groupname 'Math Helpers/Administrators';
$timecutoff TIMENOW $vbulletin->options['cookietimeout'];
$output '<div class="restore"><ul>';

$groupid_arr explode(','$groupid);
$qwhere '';

foreach (
$groupid_arr AS $id)
{
    
$qwhere .= 'OR ' $id ' IN (user.membergroupids) ';
}

$users_online $vbulletin->db->query_read("
    SELECT user.*
    FROM " 
TABLE_PREFIX "user AS user
    INNER JOIN " 
TABLE_PREFIX "session AS session
    ON session.userid = user.userid
    WHERE user.usergroupid IN (" 
$groupid ")
    " 
$qwhere "
    AND session.loggedin > 0
    AND session.lastactivity >= " 
$timecutoff "
    GROUP BY user.userid
    ORDER BY user.lastactivity DESC
"
);

$count 0;
while (
$member $db->fetch_array($users_online))
{
    
$output .= '<li>' helper_link($member$member['lastactivity']) . '</li>';
    
$count++;
}

$output .= '</ul></div>';

$output '<div style="text-align: center; font-weight: bold; margin-bottom: 1em">' $count ' ' $groupname ' Online</div>' $output;

return 
$output;

function 
helper_link($user_name$dateline)
{
    global 
$vbulletin;
    
$link 'member.php?do=getinfo&username=' $user_name['username'];

    if (
$user_name['displaygroupid'])
    {
        
$groupid $user_name['displaygroupid'];
    }
    else
    {
        
$groupid $user_name['usergroupid'];
    }

    
$open_tag $vbulletin->usergroupcache[$groupid]['opentag'];
    
$close_tag $vbulletin->usergroupcache[$groupid]['closetag'];
    
$title 'Last Activity: ' vbdate($vbulletin->options['dateformat'], $dateline1) . ' at ' vbdate($vbulletin->options['timeformat'], $dateline);
    return 
'<a title="' $title '" href="' $link '">' $open_tag $user_name['username'] . $close_tag '</a>';

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:03 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07614 seconds
  • Memory Usage 2,269KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete