PDA

View Full Version : [HowTo] Categorize Who's Online on Forumhome


KuraFire
09 Jan 2003, 11:48
HACK: [HowTo] Categorize Who's Online on Forumhome
BY: KuraFire [www.kurafire.com]
REQUESTED BY: Xiphoid [www.creations.nl]
DESCRIPTION: Divide the active users bit on Forumhome into a Staff: section and Members: section
DIFFICULTY: Easy
INSTALL-TIME: 5 minutes

Xiphoid asked for a categorization on forumhome (Staff / Members) for vB 3, but since it's such an easy thing I decided not to wait for vB 3 but just make the hack myself :)

Kudos to xiphoid for a good idea :)

EXAMPLE HERE: click here for an example of this hack (http://kurafire.com/thecouch/?munchie=1)

Warning / note: The || and && operators in original vB code I put in the instructions here that you need to search on MIGHT BE "or" and "and" in your version. Keep that in mind if you can't find the code!

Note: I wrote this on my own board which is currently still version 2.2.5, it might well work on any version above that but that is not yet tested or confirmed! (nor for versions below)

INSTRUCTIONS ARE IN THE ATTACHMENT :)

If something did not work right, you did not follow the instructions properly :)

Enjoy! :)

Kars10
09 Jan 2003, 11:54
Damn Cool!! Thanks KuraFire!!
Install this right now!! :)

Xenon
09 Jan 2003, 12:06
looks nice :)

also can you please delete the instructions from your post and just put it in the textfile, so unlicenced users can't get it?

KuraFire
09 Jan 2003, 12:19
hmkay...

X-Fan
09 Jan 2003, 14:09
Is it possible to adapt this for the WOL page proper?

Boofo
09 Jan 2003, 16:04
Excellent hack. Thanks! :)

My second instance that you said to comment out of this code has a comma in it. Do we need to put a comma back in the line above it or anything?

eval("\$activeusers .= \", ".gettemplate('forumhome_loggedinuser')."\";");

Also, if a staff member is online and invisible, will the staff tag still show up on the line and be blank or will it not show up to regular members? If I am the only staff member online and in Ghost mode, I really don't want the Staff: to show up, if possible. That would pretty well give it away that there is a staff member online but invisible. :)

KuraFire
09 Jan 2003, 16:44
Do we need to put a comma back in the line above it or anything?

Nope, thanks for pointing that out!
The comma's between usernames are added with the implode() function that I call at the end of the hack part. You should not have any comma's (string-comma's, not code-related ones) in your code anymore....

Also, if a staff member is online and invisible, will the staff tag still show up on the line and be blank or will it not show up to regular members? If I am the only staff member online and in Ghost mode, I really don't want the Staff: to show up, if possible. That would pretty well give it away that there is a staff member online but invisible.
I do believe that it won't appear unless there is at least 1 VISIBLE member in that section (staff or members). I looked at the code and it should work that way, if it doesn't, let me know okay? :)

Is it possible to adapt this for the WOL page proper?
You mean sort the display of Who's Online (online.php) into a Staff and Members (and Guests?) section as well?

That's possible but that can't be done with this hack, I'd have to write a whole different kind of hack for that. The WOL page works quite a bit differently, more complex and all.....

Boofo
09 Jan 2003, 16:51
Thanks for the quick response. :) It's hard to tell if the Staff shows up since I will see it as the Admin even for invisible staff. I'll check with someone on line at the time and see if they can see it. I'll let you know what I find out. :)

Thanks again for a very useful hack. :)

KuraFire
09 Jan 2003, 16:57
I could check it out for you right now if you've installed the hack on your live board already... :)

Boofo
09 Jan 2003, 17:00
Ok, great. I'm there now. Do you need the URL? It is in my profile unless you want it here. :)

KuraFire
09 Jan 2003, 17:11
I'm looking at the forumhome on your site but I'm not seeing any members logged in, be they staff or normal.

Only 1 member and 1 guest, me being the guest, I'm assuming you're the member, thus the invisible admin, and I can't see you, nor do I see "Staff:" anywhere :)

So I take it that all works then, eh? :)

Boofo
09 Jan 2003, 17:16
Yes, that was i hiding. :) Great! Thanks for checking it out. Now If I can figure out a way to not have it show up for the amount of users online if I am an invisible Admin, then there would be no way to tell at all when I was on there. :)

Again, thanks for checking it out and releasing another great hack. The quotes hack and search by ID hack are up and running well along with this one now. "If you release it, I will install it." :)

KuraFire
09 Jan 2003, 17:42
See your PM's boofo :):up:

Boofo
09 Jan 2003, 17:55
Right back at ya. ;)

Dean C
09 Jan 2003, 18:27
Nice hack kurafire - good to see you around the place again :p

Chris M
09 Jan 2003, 20:53
Nice Kura:)

Satan

KuraFire
09 Jan 2003, 21:21
Originally posted by Mist
Nice hack kurafire - good to see you around the place again :p

Thx :)

I've been quite busy with hacking vB and adding features and all, but they're all so integrated with one another on my site that
a) I can't possibly release one of them unless I release every change and every hack all together;
b) I don't want to release several of these hacks, so that kind of makes it impossible for me to release any of them.

That's why I haven't been around much. Today, xiph pointed me to that Staff/Member thingy and I figured, hey, that's a nice idea for a hack, and also one for vb.org :)

So I did ^_^

Areku
09 Jan 2003, 21:35
Worked like a charm on vb 2.2.0!

Thanks!!

KuraFire
10 Jan 2003, 10:54
anyone got this working on vB 2.2.9 yet?

Boofo
10 Jan 2003, 10:58
That's the version I am running and it works good for me. :)

KuraFire
10 Jan 2003, 11:13
okay, great :)

Floris
10 Jan 2003, 12:23
First of all, thank you Kura. Glad you liked my idea and that we could realize it with a little hack.

It works perfectly on my 2.2.9 board at http://creations.nl/ :banana:

I added a little code to it, so the staff links to the forum leaders page and the members link to the memberlist page.

Link 'Staff' to 'Forum Leaders' Page - addon:
and
Link 'Members' to 'Memberlist' Page - addon:
Find:$activeusers = iif($staffusers!="", "Staff: $staffusers <br />", "") . iif($normalusers!="", "Members: $normalusers", "");and replace with:$activeusers = iif($staffusers!="", "<a href=\"$bburl/showgroups.php?s=\">Staff</a>: $staffusers <br />", "") . iif($normalusers!="", "<a href=\"$bburl/memberlist.php?s=\">Members</a>: $normalusers", "");

Just in case someone else also wants to do this, and, if you want to have it show as:

Staff:
<staff members on their own line>
Members:
<members on their own line>

Then just add a <br /> behind the Staff: part

Kiel McLeod
10 Jan 2003, 15:47
i tried it on 2.2.9 and i couldn't find the code for step 2....

Xanthine
10 Jan 2003, 19:12
Thanks, works great for me, 2.2.6

www.blackassassins.org/forum

-Sidekick-
11 Jan 2003, 00:03
anyone have a screehshot of this in action?

Floris
11 Jan 2003, 00:28
Originally posted by -Sidekick-
anyone have a screehshot of this in action?

You can surf to www.creations.nl and see it live

Bugz
11 Jan 2003, 01:38
Originally posted by -Sidekick-
anyone have a screehshot of this in action?


Originally posted by xiphoid


You can surf to www.creations.nl and see it live


i would like to see it on a site were there are admins mods and so forth to see the full bang of it

it looks good from what i can see.

Floris
11 Jan 2003, 10:09
one admin
one mod
one member
:) happy now? :)

KuraFire
12 Jan 2003, 11:47
There is also a big EXAMPLE link in the first post which you could check, my board nearly always has a staffmember and 3-5 normal members _at least_ online at any time. Average is about 12 ppl in total of which 2-3 staff.. :)

bromyaur
16 Feb 2003, 10:49
Will be installing this later but I have a small question, at this site

http://creations.nl/

I see it has a listing for robots, is that a seperate hack? I have searched here for that and cant seem to find reference to it.

Thanks

Floris
16 Feb 2003, 22:17
Yeah, vB archive.

Conundrum9
02 Mar 2003, 22:38
Which staff are listed? Obviously admins, but are both supermods and forum mods listed in the staff section or just supermods?

If it's both is there an easy way of changing it so that only supermods are listed with the staff, while forum mods stay listed with members?

impakt
05 Mar 2003, 07:56
I got this to work on 2.3.0

Great hack, and good job. :)

WEForums
23 Apr 2003, 03:06
I am using 2.3.0, and I can't seem to find the 'closing' tag.

If you followed the instructions properly, the last thing you did now was to delete (or comment out) the SECOND occurance of this line:

eval("\$activeusers .= \"".gettemplate('forumhome_loggedinuser')."\";");
Did that.

Below that is a closing tag ( } ), and below that closing tag, paste this bit of code:

$staffusers = implode(", ", $su_r);
$normalusers = implode(", ", $nu_r);
$activeusers = iif($staffusers!="", "Staff: $staffusers <br />", "") . iif($normalusers!="", "Members: $normalusers", "");

Anyone who knows where the closing tag is could you please point it out? Thanks.

KuraFire
23 Apr 2003, 09:33
WEforums:

in vB 2.3.0, around line 196 (unhacked index.php), you will find this bit of code:


}
}
$DB_site->free_result($loggedins);


The first } that you see there, is the closing tag that I'm talking about in the Hack instructions. So, your code should look like this:




}
$staffusers = implode(", ", $su_r);
$normalusers = implode(", ", $nu_r);
$activeusers = iif($staffusers!="", "Staff: $staffusers <br />", "") . iif($normalusers!="", "Members: $normalusers", "");
}
$DB_site->free_result($loggedins);


Lemme know if you got it, now :)

WEForums
23 Apr 2003, 21:43
I was thinking great, it'll be simple now. That proves incorrect though. I did what you said, and I get this error:

Parse error: parse error, unexpected ',' in /home2/wef/public_html/forums/index.php on line 210

Line 210 is the following:

$staffusers = ", ", $su_r);

Of course this is probably an easy problem to fix for you 'veterans' but I am new to hacking up forums. I tried removing the ','s and of course that failed, lol.

Anyway, if you have an idea of what can be causing this I'd be thankful.

Also, thanks for the reply. :)

KuraFire
23 Apr 2003, 23:59
I

Hate

vBulletin.org!

*sighs*

stupid PoS system removes php functions from blocks of [php-] code! *mutters furiously*


change:


$staffusers = ", ", $su_r);

$normalusers = ", ", $nu_r);



into:



$staffusers = implode(", ", $su_r);

$normalusers = implode(", ", $nu_r);

Then it should work..

WEForums
24 Apr 2003, 00:36
I hate feeling like a "newbie." :(

Truth is, I don't have any clue how to fix parse errors. Your instructions worked to fix that parse error, but a separate part of the code (one in which is identical to an 'unhacked' vB index.php) seems to be causing a parse error. (It must be to do with this code or I completely screwed up. heh)

Anyway, the current error is:

Parse error: parse error, unexpected ')' in /home2/wef/public_html/forums/index.php on line 336

Line 336 is:

list($key1,$val1)=each($iforumcache["$forumid"]) ) {

GRRR!

I am sure I am annoying, lol. Can't wait to get enough time to study PHP.

If you need any other info (or if you're willing to help) just let me know what to do. Sorry to burden you. :(

WEForums
24 Apr 2003, 01:28
Just to give a bit more code... Lines 330 - 342:

if ($depth<$forumhomedepth) {
$forumbits.=makeforumbit($forum['forumid'],$depth+1,$forumperms);
}
} // END if can view
} // END while ( list($key2,$forum)=each($val1) ) {
} // END while )
list($key1,$val1)=each($iforumcache["$forumid"]) ) {

unset($iforumcache["$forumid"]);
return $forumbits;
}

if (!isset($forumid) or $forumid==0 or $forumid=='')

KuraFire
24 Apr 2003, 09:15
I

Hate

vBulletin.org!



Line 336 is:

list($key1,$val1)=each($iforumcache["$forumid"]) ) {

Make that:


while(list($key1,$val1)=each($iforumcache["$forumid"]) ) {

WEForums
24 Apr 2003, 20:34
*commits suicide*

Yes, that worked...for that... It seems vB.org needs to fix the problem (or is it intentional? seems stupid)

Sadly enough this is frustrating. Fix one area of code and and another is messed up. This is another parse error... it's just a little bit strange. Something to do with a variable or some crap. Here's the error:

Parse error: parse error, unexpected $ in /home2/wef/public_html/forums/index.php on line 357

What's strange about it? Line 357 is:

?>

Yeah, the closing part of the code.

FRUSTRATING.

EDIT: Are we allowed to post the full script (index.php) or not? I don't think we are so I wouldn't even try.

KuraFire
24 Apr 2003, 21:26
nope, not allowed to post full scripts, at all...

I dunno what the problem is though, but I think you should try and reinstall it using the (renewed) attachment in post 1 :p

WEForums
24 Apr 2003, 22:55
Worked perfectly. Thanks for your time AND help.

"Master Hacker" is right. ;)

KuraFire
25 Apr 2003, 09:05
*grins*

You're welcome, glad you got it working :)

Frozen Dreams
01 May 2003, 21:55
Never thought it - but actually worked on first try for me :D
awesome hack - exactly the one I wanted

thanks Kura ;)

/me clicks install

MGM
23 May 2003, 00:08
I keep getting an error, it says: Parse error: parse error in /home/virtual/site24/fst/var/www/html/forums/online.php on line 101

It comes up whenever I click on the Currently Active Users lino to go to the Who's Online page

here's the code around line 101:

$userinfo[where] = "Creating New Thread in Forum <a href='forumdisplay.php?s=$session[sessionhash]&forumid=$userinfo[forumid]'>".$forum[forumid][$userinfo[forumid]]."</a>";
}
break;
case 'newreply':
if (!$thread[title][$userinfo[threadid]] || !$forum[canview][$thread[forumid][$userinfo[threadid]]] || (!$forum[canviewothers][$thread[forumid][$userinfo[threadid]]] && $thread[postuserid][$userinfo[threadid]] != $bbuserinfo[userid])) {
$userinfo[where] = "Replying to Thread";
} else {
$userinfo[where] = "Replying to Thread <a href='showthread.php?s=$session[sessionhash]&threadid=$userinfo[threadid]'>".$thread[title][$userinfo[threadid]]."</a>";

line 101 is the line right under "case 'newreply':" i think it is anyways :p

Can ANYONE help me here! lol

MGM out

KuraFire
23 May 2003, 03:14
why are you editing online.php ?

Almax
23 May 2003, 10:08
installed worked ok ....but
there are normal members showing up in staff as well as members ?

:confused:

KuraFire
23 May 2003, 12:15
ehm?

MGM
23 May 2003, 15:28
err.... hmm.... wrong hack, sorry. I thought this hack edited online.php, i didnt know i edited index.php, argh, well, sorry to bother you. If you know how to fix it, then by all means do so, but I dont wanna bother you with a hack that doesn't belong here :P

MGM out

Areku
13 Nov 2003, 09:09
I've just turned one moderator back to REGISTERED and he still shows up as part of the STAFF.... He has tried from different computers but results are the same.

He has cleaned cookies and cache but he's still there...


Any ideas??

Floris
13 Nov 2003, 09:13
I've just turned one moderator back to REGISTERED and he still shows up as part of the STAFF.... He has tried from different computers but results are the same.

He has cleaned cookies and cache but he's still there...


Any ideas??
This has nothing to do with this hack.

KuraFire
13 Nov 2003, 09:56
I've just turned one moderator back to REGISTERED and he still shows up as part of the STAFF.... He has tried from different computers but results are the same.

He has cleaned cookies and cache but he's still there...


Any ideas??
If he still shows up as staff he is still in at least one staff group.

Areku
13 Nov 2003, 15:15
This has nothing to do with this hack.

Yes it does.

If he still shows up as staff he is still in at least one staff group.

No. He DOES NOT appear on the SHOWGROUPS.php list.
He's a REGISTERED user now.
He is NOT a moderator of ANY forum.
He does NOT see the HIDDEN moderators forum.
He has cleaned cookies and cache...

But he still appears categorized as part of the STAFF.

What else?

KuraFire
13 Nov 2003, 23:38
Check your Forum settings to see if he is still listed as a Moderator to a forum (even though he isn't in the moderators usergroup anymore).

If you can't find him there, check the database moderator tables to see if he's still among those. I think that's the problem here (caused by vB not deleting these entries properly when changing mods back to normal members, perhaps...)

Areku
13 Nov 2003, 23:48
Is that a normal issue (bug) in the 2.3.0 version of the board? I can only think of your second option as he definetly is NOT moderating any forum...

Areku
13 Nov 2003, 23:50
Found it on moderator table!

Wotta weirdo!!

KuraFire
14 Nov 2003, 08:38
Hence, 'twas nothing to do with my hack after all :)

Areku
14 Nov 2003, 09:48
blaaaaaah! :P

U must reckon this was the only place to ask for this issue :P ;)

KuraFire
14 Nov 2003, 10:13
Fair enough :)

I was the easiest way of getting a fix, for you, cos i know the code of my hack, yup. :)