PDA

View Full Version : AJAX Who's Online


Red Blaze
01-12-2006, 10:00 PM
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:

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


Above add:

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


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

Next, open your FORUMHOME template.
Find:

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

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

<div>$activeusers</div>


Replace with:

<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: <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 (https://vborg.vbsupport.ru/showthread.php?t=101412) by Marco

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



Edit: *installed* and disabled MarcoH64's Addon

IrPr
01-13-2006, 08:26 PM
1 newbie question:
what about Ajax Technology and Bandwidth ?
using Ajax Technology and hacks that based on AJAX will Increase BW Usage on my board?

Red Blaze
01-13-2006, 08:36 PM
Moosa, it doesn't have anything to do with the code you just posted. Also, I don't have "Username Management Addon - Latest Username Changes on Forumhome" by Marco.

Unfortunatly, I don't have alot of knowledge about AJAX, but from what I heard is if you have so much AJAX Technology on the site, it can increase your Server Load.

o0oicebergo0o
01-13-2006, 08:54 PM
again, these AJAX mods "sound" good, but you won't catch me even testing this script becuase I know the CPU usage will go out the roof... good concept though

I think there should be some study and modification on AJAX its self before these mods are released

IrPr
01-13-2006, 09:21 PM
sounds like AJAX Technology based on JS and JS increase CPU usage

Lea Verou
01-13-2006, 09:31 PM
Oh give the guy a break! He released something and he could not have done it and keep it to himself. You know, what you are doing is nothing but discouraging to new coders. If you don't need it don't install it but please respect his work and the members who need it and don't put him off like that.
Advice is good but you've gotten too far away from advice and are actually moaning about his release!
At least he released something and given back to the community. Have you?

Personally, I think it's an awsome idea and I would install if the number also changed... :)

Lizard King
01-13-2006, 09:38 PM
Oh give the guy a break! He released something and he could not have done it and keep it to himself. You know, what you are doing is nothing but discouraging to new coders. If you don't need it don't install it but please respect his work and the members who need it and don't put him off like that.
Advice is good but you've gotten too far away from advice and are actually moaning about his release!
At least he released something and given back to the community. Have you?


Perfectly said :)

99SIVTEC
01-13-2006, 09:47 PM
I would normally agree, but in this case AJAX is simply not a good solution for this type of mod. Install the hack if you like, but I guarantee you will be back asking why your server load is spiked through the roof. This isn't a bash towards the hack creator, just a simple observation from a programmer. AJAX is great, but people get carried away with it without understanding the technology behind it.

Every time the WOL table is pulled from the database it queries the databse table which in turn places a load on the server. Normally this isn't a big issue because the query is only done on a page refresh. With this hack the table is queried by everyone every few seconds. I hope you can understand why this is a bad idea. It's the same problem everyone has with the vbPager hack. This may work fine if you have VERY small forum that isn't very active, but it WILL kill an active forum.

Oh give the guy a break! He released something and he could not have done it and keep it to himself. You know, what you are doing is nothing but discouraging to new coders. If you don't need it don't install it but please respect his work and the members who need it and don't put him off like that.
Advice is good but you've gotten too far away from advice and are actually moaning about his release!
At least he released something and given back to the community. Have you?

Personally, I think it's an awsome idea and I would install if the number also changed... :)

IrPr
01-13-2006, 09:48 PM
sorry mates ! i just wanna report this bugs cause this hack is in beta stage

really nice work, BRAVO !

at least already installed this hack on my board and thanks to dear coder :)

Lea Verou
01-13-2006, 09:50 PM
"A simple observation from a programmer", huh? At least the guy is releasing his work not keeping it to himself like others *cough*. One post was enough to warn people. I don't see the need for dozens of such posts that have nothing new to say but only discourage him. I wish my first hack was like that.

Red Blaze
01-13-2006, 09:52 PM
I understand where 99SIVTEC is coming from. I don't have much experience with AJAX, thus proving to him that I did't really know what AJAX does to the server if used improperly. Atleast 99SIVTEC actually left a comment I can work with and not insulting my work.

IrPr
01-13-2006, 09:56 PM
it seems this plugin runs AJAX Script once per 20 seconds
this wont make CPU to the roof ;)

99SIVTEC
01-13-2006, 09:56 PM
Depends on the size of the forum.

I'm not trying to come down on the guy. It's a great start to hacking and we should all thank him for taking the time to release it. I just want to warn users of large forums that AJAX hacks such as this probably shouldn't be used. That is all.

Michelle, i'm unsure what the first part of your comment means. If you are questioning me as a programmer, then by all means do so, but you don't know me or anything I have created. I'm simply offering advice here.

Red Blaze
01-13-2006, 09:57 PM
It's actually every 60 seconds. It can be changed to a higher number if you'd like.

99SIVTEC
01-13-2006, 09:58 PM
That will surely help matters :).

IrPr
01-13-2006, 09:59 PM
It's actually every 60 seconds. It can be changed to a higher number if you'd like.

sure?

setTimeout("requestWhoOnline()", 20000)

Lea Verou
01-13-2006, 10:00 PM
I wasn't talking about 99SIVTEC. I was talking about the others who said nothing more about the server load and kept moaning. And what bugs me the most is that they have never released anything although they seem to know a bit of coding. I've said in other thread how this kind of .orger annoys me a lot. Just getting with no giving back although they can. They just keep it to themselves to make their forum "unique". And now they are discouraging people who aren't that selfish??? Gosh! :mad:

Sonikku, if your first hack is like that you are going to be a brilliant coder. ;)

Lea Verou
01-13-2006, 10:02 PM
99SIVTEC, if you didn't understand what I mean, the better a programmer you are the worse it is that you haven't released anything. It just seems selfish imho...

Red Blaze
01-13-2006, 10:07 PM
fetch_object('whoisonline').innerHTML = doReqOnline.handler.responseText
setTimeout("requestWhoOnline()", 60000)


I'm quite sure, yes.

@Michelle: You really think so? ^_^;;

IrPr
01-13-2006, 10:10 PM
fetch_object('whoisonline').innerHTML = doReqOnline.handler.responseText
setTimeout("requestWhoOnline()", 60000)


I'm quite sure, yes.

@Michelle: You really think so? ^_^;;

ok Sonikku :)
sorry im newbie in coding

Lea Verou
01-13-2006, 10:13 PM
fetch_object('whoisonline').innerHTML = doReqOnline.handler.responseText
setTimeout("requestWhoOnline()", 60000)


I'm quite sure, yes.

@Michelle: You really think so? ^_^;;

You are surely going to be a LOT better than me ;)
Look at my first hack! Only one install and that is mine :p

Brent H
01-13-2006, 10:37 PM
You are surely going to be a LOT better than me ;)
Look at my first hack! Only one install and that is mine :p

What a great idea :) This is very useful for smaller communities.

If the number changed I'd also install... Great first hack, I'm impressed.

4number8
01-13-2006, 11:18 PM
Looks great, I appreciate you sharing this with me, and look foward to seeing more of your releases :)

o0oicebergo0o
01-14-2006, 12:43 AM
Oh give the guy a break! He released something and he could not have done it and keep it to himself. You know, what you are doing is nothing but discouraging to new coders. If you don't need it don't install it but please respect his work and the members who need it and don't put him off like that.
Advice is good but you've gotten too far away from advice and are actually moaning about his release!
At least he released something and given back to the community. Have you?

Personally, I think it's an awsome idea and I would install if the number also changed... :)

you know what, you need to crawl back into the hole that you came out of. Just becuase a hack is released dosen't mean that it should be automatically accepted as something positive. I'm giving constructive knowledge, a lot of newbies see these mods, run and install them... only finding out a day later that their hosting provider has canceled their account. What these types of mods need when released are ethical warnings, a disclaimer of sort for those who don't understand what cpu & memory server load is, or what ssh is, etc. sigh, basically giving the NEGATIVE effects of these modifications along with their positives. It's only fair :tired:
BTW I have given back to the community, allowing this community to continue to exist by purchasing this thing called a vbulletin licence and giving scientific feedback on modifications for knowledgable and new administrators. Please don't reply to this Mic, you'll only find yourself trapped and lost into a loose loose due to the fact that i'm not interested in this discussion anymore after this last smiliey face :) Now, on to Ruby Tuesday's :)

IrPr
01-14-2006, 03:23 AM
any way to put this on vBA Online Users Block ???

EasyTarget
01-14-2006, 04:55 AM
way to 'get the last word in' iceberg, you sure showed her.

Lea Verou
01-14-2006, 01:21 PM
you know what, you need to crawl back into the hole that you came out of. Just becuase a hack is released dosen't mean that it should be automatically accepted as something positive. I'm giving constructive knowledge, a lot of newbies see these mods, run and install them... only finding out a day later that their hosting provider has canceled their account. What these types of mods need when released are ethical warnings, a disclaimer of sort for those who don't understand what cpu & memory server load is, or what ssh is, etc. sigh, basically giving the NEGATIVE effects of these modifications along with their positives. It's only fair :tired:
BTW I have given back to the community, allowing this community to continue to exist by purchasing this thing called a vbulletin licence and giving scientific feedback on modifications for knowledgable and new administrators. Please don't reply to this Mic, you'll only find yourself trapped and lost into a loose loose due to the fact that i'm not interested in this discussion anymore after this last smiliey face :) Now, on to Ruby Tuesday's :)

Ok, drowl on to your fantasy but when you wake up please be a little more realistic.
I didn't came out of any hole but I can understand you are judging from your own experiences.
And I will reply, if you are not interested in this disscussion do not read it. If you do reply, which will mean you read it you will prove that you are, indeed, interested in the disscussion.
Purchasing vBulletin is not giving back to this community. It's giving back to Jelsoft. You know, the coders here aren't paid or anything sp they don't benefit from your money, or anyone's money in here. Nope, you haven't given back. Discouraging new coders with stating what has already been said is not something that benefits either the hacker or the people who are going to install. 99SIVTEC's first message was enough, there was absolutely no need for your comments. You have a very big ego and that's not good for anyone here.
These newbies have small forums and CAN install this. If they have big enough forums for their account to be suspended because of this, trust me, they know these things. ;)

o0oicebergo0o
01-14-2006, 03:02 PM
Ok, drowl on to your fantasy but when you wake up please be a little more realistic.
I didn't came out of any hole but I can understand you are judging from your own experiences.
And I will reply, if you are not interested in this disscussion do not read it. If you do reply, which will mean you read it you will prove that you are, indeed, interested in the disscussion.
Purchasing vBulletin is not giving back to this community. It's giving back to Jelsoft. You know, the coders here aren't paid or anything sp they don't benefit from your money, or anyone's money in here. Nope, you haven't given back. Discouraging new coders with stating what has already been said is not something that benefits either the hacker or the people who are going to install. 99SIVTEC's first message was enough, there was absolutely no need for your comments. You have a very big ego and that's not good for anyone here.
These newbies have small forums and CAN install this. If they have big enough forums for their account to be suspended because of this, trust me, they know these things. ;)

That's funny that nonthing you said about anything is true, please stop talking to me, I think it's called harassment and i'll be giving back to the community by having you muted. God bless.

Borgs8472
01-14-2006, 03:11 PM
Hey Sonikku, could you maybe do this with the 'who's online' or somehow shunt this to another page?

It might be fun to watch the online/offline page as people join and leave, however if everyone who's visiting the forum home is doing it, it's too much IMO.

Lea Verou
01-14-2006, 05:13 PM
That's funny that nonthing you said about anything is true, please stop talking to me, I think it's called harassment and i'll be giving back to the community by having you muted. God bless.

How old are you? 14? Geez! :rolleyes:

o0oicebergo0o
01-14-2006, 06:26 PM
How old are you? 14? Geez! :rolleyes:

i'm 21 and you need to mind your own business woman, god
now you want to come, try to joke, and say "14"
simply annoying, and that's the number one reason why you don't have a real man in your life :)
stop talking to me woman lol got knit a sock

Lea Verou
01-14-2006, 06:34 PM
Lol you're funny. I don't have a man in my life, huh? Probably you need to find a girlfriend. I can assure you I am pretty satisfied with my boyfriend for more than a year now and he surely is much more a "real man" than you seem to be.
So stop talking about issues you don't know just "in case" cause you seem ridiculus. :rolleyes:

NuclioN
01-14-2006, 09:25 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!
That's strange. There's argue about the serverload and no one is asking for your method to avoid file editting. How did you code that? :)

TyleR
01-14-2006, 09:30 PM
for a first hack, this is pretty dang good..Kudos, Sonikku :)

As for server load, people, vBulletin does it already..whats one more SMALL object going to hurt? Answer: nothing.

- Tyler

NuclioN
01-14-2006, 10:14 PM
Strange thing happened. We have the spiders wol notition and when you refresh the page they're there but when this addon is refreshing...they are gone!

Red Blaze
01-14-2006, 10:25 PM
NuclioN, It only calls "activeusers". I believe that they don't call out guests and spiders.

Borgs8472, The Who's Online page already refreshes on its own.

Moosa, I'll see what I can up with to put it on vBA.

o0oicebergo0o, I apologize, but you need to shut your trap. You're talking big saying that you don't want her talking to you, but here you are repling back to her. If you want her to stop talking to you, YOU have to stop talking to her. And you'd give back to the community by doing just that.

Tony G
01-15-2006, 12:26 AM
Everyone who is flaming each other, please stop right now. This thread isn't intended for you to rip into each other like that. Got a problem? Use PM or contact each other outside the forums. That crap won't be tolerated here. Anymore further flaming posts will be deleted without warning.

Thank you.

Guest190829
01-15-2006, 12:27 AM
Please do not start flame-wars in the middle of a hack thread, or any thread for that matter. If you feel like a hack may be too server intensive, then kindly notify the hack author and I'm sure he/she will notify users that the hack is not intended for larger boards...

Sonikku, this is just a official notification that this will increase server load dramatically for boards with a handful of active members...

o0oicebergo0o
01-15-2006, 04:18 AM
Lol you're funny. I don't have a man in my life, huh? Probably you need to find a girlfriend. I can assure you I am pretty satisfied with my boyfriend for more than a year now and he surely is much more a "real man" than you seem to be.
So stop talking about issues you don't know just "in case" cause you seem ridiculus. :rolleyes:

hey now, stick to the topic, the topic is this wonderful hack, please stay focused :nervous:

EasyTarget
01-15-2006, 07:15 AM
don't be an idiot iceberg.. you're like the kid that has to do something one more time after they're told not to.

o0oicebergo0o
01-15-2006, 11:55 AM
don't be an idiot iceberg.. you're like the kid that has to do something one more time after they're told not to.

Being called an idiot dosen't really sit well with me. That's a very disrespectful thing to say and it trully just took a tool on my emotions. You need to grow up, fast. But I expect you to easily degrade someone within a shielded environment via binary. I'm sorry you feel this way about me without getting to know me, and i'm trully concerned for you eventhough this is a coding forum, in all honesty, mabey you should read this book (http://www.amazon.com/gp/product/0863775896/sr=1-4/qid=1137334017/ref=pd_bbs_4/102-1202226-1880168?%5Fencoding=UTF8)

Anyway, how is your experences with the server load for this modification, especially people with 50 or more concurrent users.
For another idea, possibly a secondary modification since this idea is pretty neat, how about having the number of members currently online displayed at the very top of the page, or better yet, in the status bar of your internet browser which would update its self automatically every so many minutes. Just an idea.

Club3G
01-15-2006, 03:41 PM
Guys:
Please do not start flame-wars in the middle of a hack thread, or any thread for that matter. If you feel like a hack may be too server intensive, then kindly notify the hack author and I'm sure he/she will notify users that the hack is not intended for larger boards...


Please stop.

Riku Yuizaki
02-12-2006, 03:18 AM
I have the AJAX shoutbox and my own version of this hack on my site, except I have the shoutbox set to refresh every 10 sec, and the onlilne list set to refresh every 30 sec and I have not noticed any difference in load..

Only problem i have is my online user hack does not work with IE for some unknown reason...

hambil
03-07-2006, 01:35 PM
but I guarantee you will be back asking why your server load is spiked through the roof.
I doubt it. A single ajax call, with a single tiny indexed database query, even multipled by a hundred active users, probably only amounts to one typical full page load.

Every time the WOL table is pulled from the database it queries the databse table which in turn places a load on the server.
A typical page refresh runs dozens of queries, and also passes much more data to the client than an ajax xml message. If you modify this hack to run only the WOL page (online.php), it would probably actually reduce server load.

Carnage
03-15-2006, 12:25 AM
I would just watch the server load. If you have even a semi active board this is going to bring it to the ground.
one thing you could do about server loads is make an admincp setting to determine how often its refreshed. Server loads wouldn't be that bad if it was every 10 or 30 secs since meny people ain't gunna hang arround on teh index for that long.

Alternativly you could make it a manual refresh in either an on mouse over of active users or on the click of a button.

Tralala
03-15-2006, 05:48 AM
Small forum here. I've replaced names with avatars, using this (https://vborg.vbsupport.ru/showthread.php?t=110058) hack.

My users love it.

Will "AJAX Who's Online" still work for me, updating the avatars displayed instead? That'd be hella cool.

MamboCube
04-11-2006, 02:20 PM
have installed ajax whos online, was wondering if it is possible for the usernames to fade on, rather than pop on, anyone know how to do this?

cool mod, like it:)

MamboCube
04-11-2006, 04:33 PM
also will u be adding to this mod?

maybe have it do the same thing but also on the viewthread and viewforum

desiforums
05-02-2006, 07:42 PM
thanks for sharing man but it didn't worked for me...

Tralala
05-07-2006, 03:30 PM
Just in case anyone's wondering, my forum's on the small side so I have less concern about server load.

That said...

As an update to this query:

Small forum here. I've replaced names with avatars, using this (https://vborg.vbsupport.ru/showthread.php?t=110058) hack.

My users love it.

Will "AJAX Who's Online" still work for me, updating the avatars displayed instead? That'd be hella cool.

I went ahead and tried it, and these hacks work GREAT together. The avatar display updates on it's own every 60 seconds, without refreshing the whole page! VERY cool indeed.

As far as server load goes, the Who's Online page (online.php) has a default auto-refresh setting (every 60 seconds) that many admins leave on... I don't see how this is much different. Compared to that, this is actually sending less data!

Not many folks leave their browser on the forum home anyway, I don't think... they'd be more likely to stay on UserCP, or inside one of the forums where new threads appear.

In any case, as I mentioned above, I have a small forum. And this is a great hack for me, I appreciate Red Blaze sharing it, and I'm happy that it works so well with the avatar hack I'd already installed!

Snake
07-21-2006, 03:23 PM
Okay I have installed this and I don't even think it's working properly. Are you sure this works fine on v3.5.4?

http://www.finalfantasyforums.net

Snake
07-24-2006, 09:26 AM
Bump!

Lalib
07-24-2006, 09:43 AM
i dont see screenshot :(

talenak
07-14-2007, 07:41 AM
I thought ajax reduced server load? Someone told me that, and I know nothing about anything to know better if they were wrong. Anyone mind clearing up my confusion?

ragtek
07-14-2007, 08:08 AM
its diffucult to say
sometimes it reduces the serverload ( for things not everytime happening, like registration => username check=> so you know after you write your name in if the name is free or not, it it wouldnt be so, you have to write all information, send the whole form to the next site where it will be checked

on the other site in this example the part is reloaded all the time; its the same as you click f5 for reload the site

Lea Verou
07-14-2007, 08:12 AM
its the same as you click f5 for reload the site

Of course its not. If you reload the whole page, a lot more queries get executed than the one for the online users.

Perhaps you could add a refresh button so that it doesn't reload for those that don't need it as well?

ragtek
07-14-2007, 08:16 AM
yes, but you reload something!

but how often do you realy make this?
and here this part is automaticaly called every 60000 milliseconds


and second thing for this hack:
theres no real fileedit needed!

at the position where the code is added into the index.php there is a hook ;)
($hook = vBulletinHook::fetch_hook('forumhome_complete')) ? eval($hook) : false;

talenak
07-14-2007, 10:22 PM
sometimes it reduces the serverload

Thanks! Between you and Michelle I finally "get" it.

Feckie (Roger)
10-31-2007, 06:33 PM
This as stopped working on 3-6-8_Patch_Level_1

Feckie (Roger)
11-07-2007, 01:49 PM
Bump.

Anyone know why this does not work on 3.68, when it worked on 3.67

Feckie (Roger)
11-11-2007, 08:23 AM
Bump again

Alfa1
02-06-2009, 06:17 PM
Does this work on vb 3.8.1?