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)

lefthome 03-18-2005 11:59 AM

Quote:

Originally Posted by Paul M
Yes, I understood what you want, but this hack cannot do that (nor will it be changed).

Thanks anyway. Like I said the hack is very nice.

sim tech 03-19-2005 05:51 AM

Installed nicely on 3.0.7... took about 3 minutes.

I noticed in my index.php I had also installed the:
"Members who have posted today" hack... you must be the same "Paul" that created that impressive one as well? My users loved that one, so I'm sure they'll be just as impressed with this latest one.

One question though (and I apologize for this) but I am a php noob and I've tried several things & all failed:

On both mods, The string:
PHP Code:

WHERE lastactivity " .$cutoff. " ORDER BY username" ); 

What the heck is the correct word to use (in place of username) if I want the names to be sorted by what time they logged in, instead of alphabetically?

Thanks-

sim tech 03-20-2005 03:42 AM

I think I may have a clue as to what the one poster was talking about as far as it not working.

Maybe he has both of your mods just like me. I found that if the
Total members that have posted today
and the
Total users that have visited today

had both of their time set to reset at midnight (not rolling 24 hours) then one of them would not work, typically the Total users that have visited today one. ( Is this because of where it's placed in reference to the other?

So I changed one to show the rolling 24 hours, and the other was just on regular time, and they both started working.

At least that's how it appeared on this end.
:alien:

PHP Code:


// ############### Paul M - Who has visited today v1.40 #################

require_once('./includes/functions_misc.php');
$now TIMENOW intval($vboptions['hourdif']);
//$cutoff = vbmktime(0, 0, 0, date('m', $now), date('d', $now), date('Y', $now));
$cutoff $now 86400 ;  // ## Uncomment this line if you want a rolling 24 hours display ## //
$todaysusers $DB_site->query("SELECT userid, lastactivity, options, username, opentag, closetag
FROM " 
TABLE_PREFIX "user as user
LEFT JOIN " 
TABLE_PREFIX "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastactivity > " 
.$cutoff" ORDER BY username" ); 

$totaltoday 0;
while (
$today $DB_site->fetch_array($todaysusers))
{
    
$today[visible] = ;
    
$totaltoday += 1;
    if (
$today[options] & $_USEROPTIONS[invisible]) 
    {
        
$today[visible] = ;
        if ((
$permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
        {
            
$today[visible] = ;
        }
    }
    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($whotoday0strlen($whotoday)-2);
}

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



// ############# Paul Marsden - Who has posted today v1.40 ###############
$now TIMENOW ;
require_once(
'./includes/functions_misc.php');
$cutoff vbmktime(000vbdate('m'$nowfalsefalse), vbdate('d'$nowfalsefalse), vbdate('Y'$nowfalsefalse));
//$cutoff = $now - 86400 ;  // Uncomment this line if you want a rolling last 24 hours.
$todaysposters $DB_site->query("SELECT userid, lastpost, options, username, opentag, closetag
FROM " 
TABLE_PREFIX "user as user
LEFT JOIN " 
TABLE_PREFIX "usergroup as usergroup ON(user.usergroupid = usergroup.usergroupid)
WHERE lastpost > " 
.$cutoff" ORDER BY username" ); 

unset (
$posttoday);
$posterstoday 0;
while (
$today $DB_site->fetch_array($todaysposters))
{
    
$today[visible] = ;
    
$posterstoday += 1;
    if (
$today[options] & $_USEROPTIONS[invisible]) 
    {
        
$today[visible] = ;
        if ((
$permissions['genericpermissions'] & CANSEEHIDDEN) OR $today['userid'] == $bbuserinfo['userid'])
        {
            
$today[visible] = ;
        }
    }
    if (
$today[visible]) 
    {
               
$wrdate vbdate($vboptions['timeformat'], $today['lastpost']);
        
$posttoday .= "<a href='search.php?do=finduser&u=$today[userid]' title='$wrdate' >";
        if (
$today[visible] == 2
        {
            
$posttoday .= $today['opentag'].$today[username].$today['closetag']."</a>*, ";
        }
        else 
        {
            
$posttoday .= $today['opentag'].$today[username].$today['closetag']."</a>, ";
        }
    }
}
if (
$posttoday)
{
    
$posttoday substr($posttoday0strlen($posttoday)-2);
}
// ############# End of Who has posted today ############### 


Paul M 03-26-2005 12:51 PM

Quote:

Originally Posted by sim tech
On both mods, The string:
PHP Code:

WHERE lastactivity " .$cutoff. " ORDER BY username" ); 

What the heck is the correct word to use (in place of username) if I want the names to be sorted by what time they logged in, instead of alphabetically?

Thanks-

You need to use 'lastvisit' - however, you also need to add this field to the SELECT statement before it will work.

Paul M 03-26-2005 12:52 PM

Quote:

Originally Posted by sim tech
Maybe he has both of your mods just like me. I found that if the
Total members that have posted today
and the
Total users that have visited today

had both of their time set to reset at midnight (not rolling 24 hours) then one of them would not work, typically the Total users that have visited today one. ( Is this because of where it's placed in reference to the other?

So I changed one to show the rolling 24 hours, and the other was just on regular time, and they both started working.

At least that's how it appeared on this end.

There is no reason both should not work, they do here. :) I did make a small change to the way the midnight cutoff is calculated a while back - you need v1.40 of the 'last visited' and v1.50 of the 'last posted' to pickup this change.

Julie 03-28-2005 11:53 AM

Hm, I didn't reply to this one!

Lol, just have to say I did one NEWBIE'ish thing on this one... I couldn't understand why it didn't work, but.. lol, I had forgotten to upload the index.php ... *bangs head in keyboard*

But, great hack! Works like a charm (as soon as you upload the index.php :P) Thanks! :)

sim tech 03-28-2005 02:56 PM

Quote:

Originally Posted by Paul M
You need to use 'lastvisit' - however, you also need to add this field to the SELECT statement before it will work.


Thank you sir. The SELECT part is what I got burned on!

trilOByte 03-31-2005 07:52 PM

Hi Paul, great hack - quick question though. I also have (had) your who's in chat for flashchat installed, but intstalling this munged the if conditional in the forumhome template. Any idea how to amend the template to allow both to work?

Thanks.

Paul M 03-31-2005 08:43 PM

Not sure what you mean - but I have both installed - this is what the relevant section looks like;

Code:

<if condition="$show['loggedinusers']">

<!-- 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 -->

<!-- who's in flashchat -->
<tbody>
        <tr>
                <td class="thead" colspan="2">
                        <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_chatusers')"><img id="collapseimg_forumhome_chatusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_chatusers].gif" alt="" border="0" /></a>
                        Members currently in the Chat: $totalchatters
                </td>
        </tr>
</tbody>
<tbody id="collapseobj_forumhome_chatusers" style="$vbcollapse[collapseobj_forumhome_chatusers]">
        <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">$chatters</div></td>
        </tr>
</tbody>
<!-- end who's in flashchat -->

<!-- logged-in users -->
<tbody>
        <tr>
                <td class="thead" colspan="2">
                        <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
                        <a href="online.php?$session[sessionurl]">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
                </td>
        </tr>
</tbody>
<tbody id="collapseobj_forumhome_activeusers" style="$vbcollapse[collapseobj_forumhome_activeusers]">
        <tr>
                <td class="alt2"><a href="online.php?$session[sessionurl]"><img src="$stylevar[imgdir_misc]/whos_online.gif" alt="$vbphrase[view_whos_online]" border="0" /></a></td>
                <td class="alt1" width="100%">
                        <div class="smallfont">
                                <div style="white-space: nowrap"><phrase 1="$recordusers" 2="$recorddate" 3="$recordtime">$vbphrase[most_users_ever_online_was_x_y_at_z]</phrase></div>
                                <div>$activeusers</div>
                        </div>
                </td>
        </tr>
</tbody>
<!-- end logged-in users -->

HTH.

trilOByte 03-31-2005 09:08 PM

My own fault, I have a stray closing tag for a conditional and couldn't see what was going on. Thanks for your help. Both additions are great.

/me clicks install.


All times are GMT. The time now is 05:00 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.01710 seconds
  • Memory Usage 1,831KB
  • 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
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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