vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   AJAX Who's Online (https://vborg.vbsupport.ru/showthread.php?t=105233)

Red Blaze 01-12-2006 10:00 PM

AJAX Who's Online
 
First off, this is my first modification. It's tiny, it's obvious, but I'm proud of it. I have Zero Tolerance to thank, he did give me some hints and tips.

Description:
This only refreshes the names of the users in the index page of the forums. Not the "currently online" number of users. It could say currently 4 users online, and there's a huge list of usernames.
I don't really see a need of a picture since there's no visual change. It only calls the names of the users currently online and removes them if they're offline without the need of refreshing the index page of the forums.

Edits:
1 Template to edit (FORUMHOME)
1 File to edit (index.php)

First the File Edit:
Open your index.php file in your forum directory.
Find:
Code:

// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTTA HERE... ###
Above add:
Code:

if ($_GET['do'] == 'online')
{
        echo $activeusers;
        exit;
}

Save, close, then upload index.php file to your forum directory.

Next, open your FORUMHOME template.
Find:
Code:

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

Above that, add:
Code:

<script type='text/javascript'>
<!--
function requestWhoOnline()
{
        doReqOnline = new vB_AJAX_Handler(true)
        doReqOnline.onreadystatechange(ReqOnlineDone)
        doReqOnline.send('index.php?do=online')
}
function ReqOnlineDone()
{
        if (doReqOnline.handler.readyState == 4 && doReqOnline.handler.status == 200)
        {
                fetch_object('whoisonline').innerHTML = doReqOnline.handler.responseText
                setTimeout("requestWhoOnline()", 60000)
        }
}
setTimeout("requestWhoOnline()", 20000)
-->
</script>

Now Find:
Code:

<div>$activeusers</div>
Replace with:
Code:

<div id="whoisonline">$activeusers</div>
====================

Since this is my first mod, I'd back up the files. Forgive me if this hack has already been done. I made a strict search and found no such thing. I decided to try to do it, and voila! Go me.

99SIVTEC 01-13-2006 05:18 PM

wont this kill the server on active forums? It runs the WOL queries every second to find out who is online.

waza 01-13-2006 05:24 PM

I don't see why this has to be in ajax..

croportal 01-13-2006 05:58 PM

and screenshots,




I don't see why this has to be in ajax..

goyo 01-13-2006 06:05 PM

Thanks...great modification...

Many of my members using the ajax chatbox (so they're on the index page most of the time)...Now they can track who's in...

Red Blaze 01-13-2006 06:12 PM

I didn't think there had to be a screen shot as that there isn't any visual change. If you don't need this, that's ok. I just wanted to share what I did.

99SIVTEC 01-13-2006 06:24 PM

I would just watch the server load. If you have even a semi active board this is going to bring it to the ground.

Snake 01-13-2006 07:00 PM

Thanks!

ChurchMedia 01-13-2006 07:01 PM

Great hack! Works perfectly. **installs**

I did add the code change for index.php as a plugin instead of hacking the file. It's the forumhome_complete hook.

Thanks!

IrPr 01-13-2006 08:19 PM

Nice Hack! but seems a little buggie

1:Currently Active Users: X ( Y Members And Z Guests )
this code:
Code:

                        <a href="online.php$session[sessionurl_q]" rel="nofollow">$vbphrase[currently_active_users]</a>: $totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_and_y_guests]</phrase>)
                </td>

2:not compatible with Username Management Addon - Latest Username Changes on Forumhome by Marco

Quote:

Warning: implode(): Bad arguments. in \includes\functions_mh_unm.php on line 198


Edit: *installed* and disabled MarcoH64's Addon


All times are GMT. The time now is 01:54 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.01645 seconds
  • Memory Usage 1,739KB
  • 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
  • (7)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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