PDA

View Full Version : Mini Mods - Cel User Always Online


cellarius
03-12-2014, 11:00 PM
What does it do?
This addon simply lets you define one or several users (or usergroups) that will be always shown as online in the Who's Online section and other parts of the forum.

How does it work?
It adds a cron job that updates the last activity entry in the session table for the given users. It is set to run every ten minutes. If your session length is shorter, you will need to adapt the cron job. (You can check your session timeout at AdminCP->Settings->Options->Cookies and HTTP Header Options, it needs to be more than 600, 900 is default).

How to install
Just download, upload the contents of the UPLOAD folder to your forum root, and import the product file of the addon. Then go to AdminCP->Settings->Options and enter the userid(s) of the users (or usergroup ids) you want to be always online in the Cel User Always Online section. Then the users need to log in once manually, to get things started.

Other versions of vB?
This addon should work with every Version of vB4, and most likely on vB3, too (not tested).

ozzy47
03-13-2014, 12:05 PM
Cellarius, your missing the contents to upload. :)

New Joe
03-13-2014, 12:44 PM
I see the xml file there...

webmastersun
03-13-2014, 01:30 PM
Seem you uploaded missing files

Warning: include_once([path]/./includes/cron/cel_user_always_online.php) [function.include-once]: failed to open stream: No such file or directory in [path]/admincp/cronadmin.php on line 116

Warning: include_once() [function.include]: Failed opening '[path]/./includes/cron/cel_user_always_online.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in [path]/admincp/cronadmin.php on line 116


where is cel_user_always_online.php file ?

Imported XML file and config in option ACP but didn't show users on Who is online on my forum

I didn't understand this
It adds a cron job that updates the last activity entry in the session table for the given users. It is set to run every ten minutes. If your session length is shorter, you will need to adapt the cron job.

I removed cron job function at footer template, it is reason cause error and didn't show users online by IDs ?

dandanch
03-13-2014, 04:36 PM
I'll wait until the files are updated, but this looks promising;

cellarius
03-13-2014, 09:51 PM
Sorry, I misclicked when uploading. Got the xml instead of the zip next to it - sorry, folks!

ozzy47
03-13-2014, 10:26 PM
It happens to all of us brother. :)

tanzeelniazi
03-13-2014, 10:42 PM
any screen shoot please

dandanch
03-13-2014, 10:43 PM
Just ran this on test server and got this error:

Database error in vBulletin 4.2.2:

Invalid SQL:

UPDATE session
SET lastactivity = NOW
WHERE userid IN (1);

MySQL Error : Unknown column 'NOW' in 'field list'
Error Number : 1054
Request Date : Friday, March 14th 2014 @ 12:37:17 AM
Error Date : Friday, March 14th 2014 @ 12:37:17 AM
Script : http://localhost/admin/cronadmin.php?do=runcron&cronid=1623
Referrer : http://localhost/admin/cronadmin.php?do=modify
Username : admin
Classname : vB_Database
MySQL Version : 5.1.72-cll

ForceHSS
03-13-2014, 10:48 PM
Your cron brings an error
Database error in vBulletin 4.2.2:

Invalid SQL:

UPDATE session
SET lastactivity = NOW
WHERE userid IN (1);

MySQL Error : Unknown column 'NOW' in 'field list'
Error Number : 1054
Request Date : Thursday, March 13th 2014 @ 03:38:23 PM
Error Date : Thursday, March 13th 2014 @ 03:38:23 PM
Script : http://www.mystechtronics.net/another/cronadmin.php?do=runcron&cronid=90
Referrer : http://www.mystechtronics.net/another/cronadmin.php?do=modify
IP Address :
Username :
Classname : vB_Database
MySQL Version : 5.5.33-31.1

cellarius
03-13-2014, 10:51 PM
Hm. It seens something went wrong when packing the thing. That clearly is an old version of the file. Let me check that out. I'm going to remove the file until for a moment.

Really sorry, guys - I should not have whipped this up during my lunch break...

cellarius
03-13-2014, 10:58 PM
OK, I just reuploaded. For those who already installed: just replace the includes/cron/cel_user_always_online.php file, no changes in the product xml.

Thanks for your patience ;)

cellarius
03-13-2014, 11:00 PM
any screen shoot please
What do you expect to see? This addon just keeps certain users online permanently.

ForceHSS
03-13-2014, 11:04 PM
Do members need to login first then it keeps them logged in before this works or does it matter

cellarius
03-13-2014, 11:11 PM
Yes, they need to log in once, so there is a entry for them in the session table that can be updated.

ForceHSS
03-13-2014, 11:28 PM
i logged in all members but only shows me ran the cron did not keep them logged in

ForceHSS
03-13-2014, 11:36 PM
Logging them in again for longer and running cron to see if it works

dandanch
03-14-2014, 01:22 AM
Works pretty good, but it's not showing them as logged in in there profile. Thanks for the mod:)

ForceHSS
03-14-2014, 01:30 AM
Removed as it logs them out after a while

webmastersun
03-14-2014, 02:15 AM
i logged in all members but only shows me ran the cron did not keep them logged in

The same result.

I set UserIDs 18,185,28,36,68,95 in Cel User Always Online option
and I tried to log in some accounts but it was not working, didn't show usernames on forum home and keep them as logged in.

ForceHSS
03-14-2014, 04:32 AM
To the op if you could make it that it picks all registered members per group you pick and auto loads them then it would work better

webmastersun
03-14-2014, 05:09 AM
To the op if you could make it that it picks all registered members per group you pick and auto loads them then it would work better
I agree with this idea or you can add a tick option to in user profile thus we will select "users always online" easily.
Not interested in using cron job for Mod. :)

cellarius
03-14-2014, 08:13 AM
Logging them in again for longer and running cron to see if it works

Removed as it logs them out after a while

It definitely works for me. My session timeout is default at 900 sec, i.e. 15 minutes. If your session timeout is less than 600, your users will be logged out, and you'll need to adapt the cron settings to execute it more often.

Also, if you're testing this on a test installation with no real traffic, the cronjob will not be executed and your users will be logged out, too. I've been testing with an auto page refresh addon for chrome, refreshing the forum home page every 10 sec to simulate traffic.

Have my test users logged in on my test board for over seven hours straight now.

cellarius
03-14-2014, 08:14 AM
Works pretty good, but it's not showing them as logged in in there profile. Thanks for the mod:)
I'll look into that.

cellarius
03-14-2014, 08:22 AM
To the op if you could make it that it picks all registered members per group you pick and auto loads them then it would work better

I honestly would not have thought that you would want this for whole usergroups (using this on a large scale will spam your Who's online and confuse your users). Since the usergroup is not in the session, it will require an additional query. I'll think about it.

cellarius
03-14-2014, 08:23 AM
I agree with this idea or you can add a tick option to in user profile thus we will select "users always online" easily.
Not interested in using cron job for Mod. :)
This will not happen. I just coded this since it was requested and I had an idea for a quick fix. If it is too cumbersome for you to add an userid to the list in the options, or it is somehow against your standards to use a cron job in an addon, then just don't use this. Good luck in finding another method.

cellarius
03-14-2014, 08:29 AM
The same result.
Since you posted this in the other thread:
I removed cron job command at footer template, it is reason cause error and didn't show users online by IDs ?
Then, of course, this will not work. But you'll have other issues if your cronjobs do not work. Why in heaven would you remove the cronjob command?

BTW: If you want any answers from me, post in this thread. I will not monitor any other threads, and I don't do support by PN unless I request you contact me. Plus: Note that this addon is marked as beta, and as not supported. Also, you won't get any more answers if you don't mark the addon as installed.

webmastersun
03-14-2014, 08:56 AM
Then, of course, this will not work. But you'll have other issues if your cronjobs do not work. Why in heaven would you remove the cronjob command?

I added back {vb:raw cronimage} to footer template and amazing that why I added 4 UserIDs but only 1 userid is showed always online :)
must wait for 15 minutes to Cron runs ?

cellarius
03-14-2014, 09:33 AM
You need to log in every user at least once, so there is an entry in the session table that can be updated. If you don't do that, it will not work.

The cron runs every ten minutes, and you'll notice a difference only if
1) more time goes by than your normal session timeout (since after that time the user would normaly be no longer shown as currently online)
2) that user does not have any other activity during that time, since then he would be shown as currently online anyway.

I wonder how you would even tell if this addon works if you don't wait at least as long as your session timout. (But keep in mind there needs to be activity on your board for the cron to run, as explained above).

Once again: If you want further answers, mark this addon as installed. I have asked you to do that before, and I think its not too much to ask. I will ignore further questions until you do that.

cellarius
03-14-2014, 09:51 AM
New version: 4.2.002

- added option to select usergroups to be always online
- fixed inactivity issue on profile page.

webmastersun
03-14-2014, 10:35 AM
You need to log in every user at least once, so there is an entry in the session table that can be updated. If you don't do that, it will not work.

The cron runs every ten minutes, and you'll notice a difference only if
1) more time goes by than your normal session timeout (since after that time the user would normaly be no longer shown as currently online)
2) that user does not have any other activity during that time, since then he would be shown as currently online anyway.

I wonder how you would even tell if this addon works if you don't wait at least as long as your session timout. (But keep in mind there needs to be activity on your board for the cron to run, as explained above).

I think you should improve it to easy for users. According to me, it's rather complex for using and controlling. May be I set session time out higher than you thus I got result not as my expectation.
It is possible to have a radio button on each user profile so when we can update ( turn on/off status) to show user online immediately ? without waiting for Cron runs. :cool:

or other way to show user that don't need to wait them must not login once to forum ? ...etc

Just my ideas.

Thanks for your new version and I will update next versions and hope it will better than previous.

cellarius
03-14-2014, 11:11 AM
You need to log the user in once to create a valid entry in the session table, and you need the cron to simulate user activity. And no, what you suggest is not possible - that's just not how vB works.

If it is really too much trouble for you to install this, enter some userids or usergroup ids in the AdminCP and then log in the users you want this for once, then I'm sorry. This addon does what you asked for in the other thread, in the only way possible that I can think of. If it does not meet your comfort standards, then don't use it. You can always hope someone will come up with a better idea.

I really just whipped this up to help you out. I don't even have use for this myself. (And to tell the truth, this "it's too hard to use, make it easier, do it different although I have no clue myself"-attitude reminds me of why I once decided not to do stuff like that anymore...)

ozzy47
03-14-2014, 11:24 AM
Also one of the ways a user may not appear online, that logged in, and you have them set to stay logged in, is if they manually clicked on the log out button. Because what that does is remove their info from the session table, unless of course Cellarius wrote something it to prevent that, I am not sure though, as I have not looked into the code.

cellarius
03-14-2014, 11:28 AM
Also one of the ways a user may not appear online, that logged in, and you have them set to stay logged in, is if they manually clicked on the log out button. Because what that does is remove their info from the session table, unless of course Cellarius wrote something it to prevent that, I am not sure though, as I have not looked into the code.

No, I did not provide for that. If people specifically log out, then this is probably what they want to do (and it also is the way to end being permanently online).

ozzy47
03-14-2014, 11:30 AM
Absolutely, I was just letting people know another reason someone may not appear as online, and try and blame the mod as not working. :)

cellarius
03-14-2014, 11:31 AM
Absolutely, I was just letting people know another reason someone may not appear as online, and try and blame the mod as not working. :)
And right you are :)

webmastersun
03-14-2014, 11:48 AM
Also one of the ways a user may not appear online, that logged in, and you have them set to stay logged in, is if they manually clicked on the log out button. Because what that does is remove their info from the session table, unless of course Cellarius wrote something it to prevent that, I am not sure though, as I have not looked into the code.
I think so, It may be reason why user didn't appear online :)

You need to log the user in once to create a valid entry in the session table, and you need the cron to simulate user activity. And no, what you suggest is not possible - that's just not how vB works.

If it is really too much trouble for you to install this, enter some userids or usergroup ids in the AdminCP and then log in the users you want this for once, then I'm sorry. This addon does what you asked for in the other thread, in the only way possible that I can think of. If it does not meet your comfort standards, then don't use it. You can always hope someone will come up with a better idea.

I really just whipped this up to help you out. I don't even have use for this myself. (And to tell the truth, this "it's too hard to use, make it easier, do it different although I have no clue myself"-attitude reminds me of why I once decided not to do stuff like that anymore...)
I thought it can be easier but no, it depends on vB works, I see that and appreciated your efforts although it's in beta version.

I thought have a better way without using cron job and session, just creating a tick button in user profile to update their status immediately and show them on forum home. But if it's impossible with the way vB works then I can accept that.

For me, a great add-on is easy in using and full functions what a user needs and can run well on all versions or their configurations. :D

I see because this is only your beta version.

Thanks Cellarius!

cellarius
03-14-2014, 12:07 PM
Once again: Since the session is the thing that vB determines by whether a user is currently online or not, you can't do it without sessions. Just as you can't show threads without the thread table or posts without the posts table. Like it or not.

So, I'm sorry this does not qualify as a great addon on your scale, but I can live with that. Sadly I have to work with what vB makes possible, not what you wish for. You can always file a suggestion in JIRA, and good luck with that.

Adding a button in the profile to do what the cronjob does for a single user would not be that hard. But what I really can't follow is why you'd rather click on a button in every user's profile every 15 minutes than to have that done automatically with a cronjob, but hey - each to his own I guess. Do you have partners to click through the nightshifts?

Anyway, I still find your attitude extremly annoying. If there was someone out there who coded a perfectly working addon for free on my request, I would surely not continously post that I felt it was too complicated, not comfortable enough and done the wrong way.

And now, just when you're finally forcing yourself to at least "appreciate the effort" and mutter a "thank you", you can't resist to state that you can perfectly understand why it is "only beta" and really not a great addon. As I said before, its miserable figures like you that make coders think twice before offering help.

Just for the record: This addon is no longer beta, and from now on, is (really) unsupported - maybe I'll do bugfixing if a bug in current functionality should be found. It is what it is now, and will not be improved upon. It works as it is, so take it or leave it.

webmastersun
03-14-2014, 12:26 PM
Once again: Since the session is the thing that vB determines by whether a user is currently online or not, you can't do it without sessions. Just as you can't show threads without the thread table or posts without the posts table. Like it or not.

So, I'm sorry this does not qualify as a great addon on your scale, but I can live with that. Sadly I have to work with what vB makes possible, not what you wish for. You can always file a suggestion in JIRA, and good luck with that.

Adding a button in the profile to do what the cronjob does for a single user would not be that hard. But what I really can't follow is why you'd rather click on a button in every user's profile every 15 minutes than to have that done automatically with a cronjob, but hey - each to his own I guess. Do you have partners to click through the nightshifts?

Anyway, I still find your attitude extremly annoying. If there was someone out there who coded a perfectly working addon for free on my request, I would surely not continously post that I felt it was too complicated, not comfortable enough and done the wrong way.

And now, just when you're finally forcing yourself to at least "appreciate the effort" and mutter a "thank you", you can't resist to state that you can perfectly understand why it is "only beta" and really not a great addon. As I said before, its miserable figures like you that make coders think twice before offering help.

Just for the record: This addon is no longer beta, and from now on, is (really) unsupported - maybe I'll do bugfixing if a bug in current functionality should be found. It is what it is now, and will not be improved upon. It works as it is, so take it or leave it.
Exactly :D and of course, everyone is always to find a new & better way for them and the same to me, I will use new add-on if it suits my requirements better yours. But at this time, no more add ons on vB can do better than yours thus I will still use yours although it's not as my expectation ;)

Nirjonadda
03-14-2014, 08:45 PM
Please can you try add option "How many time show user online" If member does not come back this period than goes to auto offline. Also add option Enable Mod on/off.

Krusty1231
03-14-2014, 09:56 PM
This solved an issue for me. I thank you cellarius for this modification.

Works as posted.

Rated and installed.

Now my WOL matches the profile online.

Nirjonadda
03-15-2014, 10:45 AM
With this mod member Current Activity does not showing, Please can you look into and give fix update on this bug issue ?

cellarius
03-15-2014, 02:25 PM
Please can you try add option "How many time show user online" If member does not come back this period than goes to auto offline. Also add option Enable Mod on/off.
No further options will be added. Plus, what you wish for would be possible only with extreme efforts.

With this mod member Current Activity does not showing, Please can you look into and give fix update on this bug issue ?
This addon does not change the current/last activity of the user in the session table. It will always show what the user's last activity was. This will also not be changed, sorry.

ForceHSS
03-17-2014, 09:26 PM
Removed again as after a while it seems to remove members from the who's online list. So after they logged in the cron ran they log out after a few mins it removes there name from the list

ozzy47
03-17-2014, 09:29 PM
Removed again as after a while it seems to remove members from the who's online list. So after they logged in the cron ran they log out after a few mins it removes there name from the list

Well of course if the user logged out in his browser by clicking the log out button, the mod can not keep them logged in. When they do that, it deletes their info from the session table.

ForceHSS
03-17-2014, 10:08 PM
They did not log out just close the browser it did show them online for a few mins after this

cellarius
03-17-2014, 10:40 PM
Removed again as after a while it seems to remove members from the who's online list. So after they logged in the cron ran they log out after a few mins it removes there name from the list
No offense, but if a user wants to be shown as online all the time, logging out is a somewhat counterproductive. What do you expect this addon to do - magically log that user in again, when they choose to log out?

cellarius
03-17-2014, 10:49 PM
They did not log out just close the browser it did show them online for a few mins after this
Then either your cronjob does not work for any reason or you don't have enough visitors to trigger the cron. Is this a testboard?

I positively can keep users active for hours, if a) the cron runs correctly and b) the session is not destroyed by logging out.

ForceHSS
03-17-2014, 10:53 PM
Its a live site and no idea why it does not work.

ged
03-18-2014, 07:00 AM
I've got a similar problem.

I've got 1 user who is shown online on Forumhome and his Profile page, but not on Who is online list.

The problem is that, when I was online on forum, this user showed up on who is online list for hours (even though I've closed his browser), but when I turned off my computer (without loggin out) and went to sleep, he (according to my friends) froze on who is online list. But, he was still showing online on forumhome and profil page in ten minutes' periods.

After I restarted my computer and opened my forum page, he didn't return to who is online list, but still active on these two pages.

I've no idea. Did I screw something up? :)

cellarius
03-18-2014, 09:22 AM
I'll look into how Who's online compiles the list in comparison to the forumhome display when I get the chance.

ged
03-18-2014, 11:17 AM
I'll look into how Who's online compiles the list in comparison to the forumhome display when I get the chance.
Thank you very much. It will be appreciated. :)

cellarius
03-18-2014, 08:27 PM
Hi ged, I'm sorry, but I can't reproduce this or trace what the issue could be. I still have it running smoothless on my testboard, even with no user active at all (i.e. main browser closed, auto page refreshs for the cron in a different browser as a guest). :-(

AK47-
03-18-2014, 09:53 PM
Doesn't work on 4.2.1

ForceHSS
03-18-2014, 09:58 PM
Doesn't work on 4.2.1
In what way did it not work for you. Did you get an error message.

AK47-
03-18-2014, 10:02 PM
In what way did it not work for you. Did you get an error message.


if i have eg 4 users online. I chose usergroup eg 6 no change to user online at the bottom of the forum

ForceHSS
03-18-2014, 10:06 PM
Did you run the cron manually

cellarius
03-18-2014, 10:06 PM
if i have eg 4 users online. I chose usergroup eg 6 no change to user online at the bottom of the forum
Well - what do you expect to happen? Have you read and followed the instructions?

ged
03-19-2014, 08:42 AM
Hi ged, I'm sorry, but I can't reproduce this or trace what the issue could be. I still have it running smoothless on my testboard, even with no user active at all (i.e. main browser closed, auto page refreshs for the cron in a different browser as a guest). :-(

Doesn't matter, you tried and created a good modification. :)

I will try it again, with different situations, users, etc. :)

madness85
03-19-2014, 10:13 AM
This is very interesting I was looking for a way for users to stay online until they close their browser but I didn't want them to stay online permanently. You guys think this is possible?

cellarius
03-19-2014, 10:38 AM
Not with this addon - it's been created specifically to keep the users online.

karabaja3
02-26-2015, 01:24 AM
Did anyone tried using this mod at v3.8.

Coder2016
02-15-2017, 02:26 PM
User is not online at 4.2.3

ikymbo
03-16-2017, 12:40 AM
it dont work on 4.2.4