PDA


View Full Version : How to exclude Admin group 6 from top post


JohnBee
05-11-2005, 02:27 PM
I received help on this for my forums I wondered if it was possible to
do the same on my vBa pages?

I would like to exlclude groupid 6 from the top post announcement.

Brian
05-11-2005, 02:56 PM
You should be able to apply the same code changes to your forum/modules/stats.php file.

JohnBee
05-11-2005, 05:27 PM
.thumbsup.

Worked like a charm !

mfarmerhi
05-13-2005, 07:03 AM
John or Brian, mind posting up what the code would be and some direction where the hack would go?

As the mod of my board, I (needless to say) have the most posts. I'd like to exlude my name, instead displaying the highest Member...

Thanks ahead of time.

~ Mark

JohnBee
05-13-2005, 07:34 AM
Okay.
For my forums I'm using a small template mode for me Top poster.

// Top Poster (Template Mod Style)
// Original: Lesane
// vB3 Re-Make: assassingod (ffdcsite)

Step one:
Open up the 'phpinclude_start' template and at the bottom, add:
if (THIS_SCRIPT == "index")
{
$topposter = $DB_site->query_first("
SELECT username,posts,userid
FROM " . TABLE_PREFIX . "user
ORDER BY posts DESC
LIMIT 1
");
}


Step 2:
Now in the FORUMHOME template, add anywhere you want:
<br />
<b>Top Poster:</b> <a href="member.php?$session[sessionurl]u=$topposter[userid]">$topposter[username]</a> (With $topposter[posts] posts!)

To exclude groupid 6 (admins) replace with this code:

$topposter = $DB_site->query_first("
SELECT username,posts,userid
FROM " . TABLE_PREFIX . "user
WHERE usergroupid <> 6
ORDER BY posts DESC
LIMIT 1
");
6 is the id you want to exclude.

For the vBadvance top poster stats I applied the same approach but
this time the modification was done in the forum/modules/stats.php
file.

Find:
$topposter = $DB_site->query_first('SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user ORDER BY posts DESC LIMIT 1');

and replace with:

$topposter = $DB_site->query_first('SELECT username, posts, userid FROM ' . TABLE_PREFIX . 'user WHERE usergroupid <> 6 ORDER BY posts DESC LIMIT 1');

Once again 6 is the group you want to exclude.

and thats it! now Admins are now excluded from the top stats on the forum
and any vBa page.

mfarmerhi
05-14-2005, 06:13 PM
Beautiful!

One more refinement: I'd also like to exlude moderators.

How would you write the "<> 6" part to exlude more than one user group?

(LOL tried just adding ",5" and that didn't work... sorry, don't know a lick of php :p )

JohnBee
05-15-2005, 12:06 AM
This is a question I also would like to know.
wanting to exlude other groups as well.

Hopefully we will get some assistance, I know Brian knows this :p

mfarmerhi
05-15-2005, 05:00 AM
It's not the most eloquent of solutions, but I ended up just enclosing everything in parenthesis and using boolean statements:WHERE ((usergroupid <> 6) AND (usergroupid <> 5) AND (usergroupid <> 4))Seems to work...

JohnBee
05-15-2005, 10:49 AM
Awesome work!
Hey after all the mess I did with my code this looks great to me :p