View Full Version : Moderator Icon on postbit
Scott MacVicar
04-30-2002, 10:00 PM
This is a hack to show a small icon next to usernames on a post, when you mouse over you will also get told what rank they are, Admin, Super Mod or Moderator.
Add the following template
postbit_moderator_icon
<img src="{imagesfolder}/mod.gif" alt="$rank">
save the template
Edit the postbit template and place $mod_logo somewhere on it, i chose next to the username.
open up functions.php
look for
// do posts from ignored users
if (!$ignore[$post[userid]]) {
ABOVE it put
switch($post['usergroupid']) {
case "6";
$rank = "Administrator";
eval("\$mod_logo = \"".gettemplate("postbit_moderator_icon")."\";");
break;
case "5";
$rank = "Super Moderator";
eval("\$mod_logo = \"".gettemplate("postbit_moderator_icon")."\";");
break;
case "7";
$rank = "Moderator";
eval("\$mod_logo = \"".gettemplate("postbit_moderator_icon")."\";");
break;
default:
$mod_logo = "";
break;
}
save and upload functions.php
The hack will now work, but if you want to save on the extra query to the database to get the template.
Open showthread.php and add
,postbit_moderator_icon to the end of $templatesused you will have to do this twice.
attached is the mod logo i used
Scott MacVicar
05-01-2002, 03:19 PM
A screenshot in case your wondering what exactly i'm talking about.
NTLDR
05-01-2002, 04:03 PM
Thanks PPN, just what I have been looking for to add to my board!
Installed with out a problem, thanks for sharing :D
lordofgun
05-01-2002, 04:37 PM
I LOVE YOU! I just asked for this yesterday!
Will install tonight!
Dean C
05-01-2002, 04:54 PM
great hack... how bout doin the same for all staff usergroups ... wud be a great addition...
Scott MacVicar
05-01-2002, 04:59 PM
If you plan to do it for all staff usergroups it means doing some queries on the database. I'll lookin into it though.
for usergroups, do this:
in functions.php add:$post[usergroupicon]='<img border="0" src="{ imagesfolder }/usergroup'.$post[usergroupid].'.gif">'then add usergroup1.gif to usergroup7.gif in your images folder.
in your postbit, place $post[usergroupicon] where you want.
CeleronXL
05-01-2002, 08:47 PM
As requsted by me a long time ago. ;) https://vborg.vbsupport.ru/showthread.php?s=&threadid=37559
Edit: Wow, this version seems to be much nicer on the database. The other one had about 60-80 queries on the showthread. Now they're way back down.
Scott MacVicar
05-01-2002, 10:05 PM
doesn't have any queries :P
CeleronXL
05-01-2002, 10:15 PM
Did the other one have a lot? Because it went down from the 60-80 to 30-40.
ExcErr
05-02-2002, 10:40 AM
it will be better, if admin can set in admin cp icons for each usergroup!
Scott MacVicar
05-02-2002, 01:52 PM
the whole point of the hack was to give this feature without adding on all the extra queries, the only solution is to add the extra query for each usergroup, so if you have 9 usergroups thats 9 queries.
ExcErr
05-02-2002, 01:55 PM
ok, i know it! it's easy!
Scott MacVicar
05-02-2002, 02:04 PM
Add a column called usergroupicon to your usergroup table.
in your showthread.php add
$icon = $DB_site->query("SELECT usergroupid,usergroupicon FROM usergroup ORDER by usergroupid");
while($icons = $DB_site->fetch_array($icon)) {
$icon_cache["$icons[usergroupid]"] = $icons[usergroupicon];
}
unset($icons);
$DB_site->free_result($icon);
You then add global $icon_cache; in the getpostbit function in /admin/functions.php and then just add $icon_cache["$post[usergroupid]"] in the postbit template. I think, not tested this is all off the top of my head.
Chris M
05-02-2002, 05:30 PM
I attached an .txt file containing the info...
Thats for those who prefer to do this offline...
Satan
Dark Odin
05-02-2002, 07:42 PM
Is there anyway to modify this to make it do something like this:
Username
User Title
Rank (User Group)
But I only want the user title bold and the rank displayed if they are Mod, Super Mod, or Admin. Can this be converted to do this cleanly, and if so how?
Scott MacVicar
05-02-2002, 07:45 PM
em yeah just change the postbit_moderator_icon template to
<b>$rank</b><br>
Dark Odin
05-02-2002, 11:29 PM
That's not exactly what I want. I want the user title to be bold, not the rank.
in post bit find
$post[username]
and replace with
<b>$post[username]</b>
Dark Odin
05-03-2002, 07:03 PM
Umm, usertitle not username, and I only want the title to be bold if they are a moderator, super moderator, or administrator. I could do all the other suggestions myself. :)
Scott MacVicar
05-03-2002, 09:22 PM
switch($post['usergroupid']) {
case "6";
$rank = "Administrator";
$post[usertitle] = "<b>$post[usertitle]</b>";
break;
case "5";
$rank = "Super Moderator";
$post[usertitle] = "<b>$post[usertitle]</b>";
break;
case "7";
$rank = "Moderator";
$post[usertitle] = "<b>$post[usertitle]</b>";
break;
default:
$rank = "";
break;
}
use that code in your getpostbit function in /admin/functions.php
Dark Odin
05-03-2002, 09:38 PM
Spiffy. Thanks!
lichtflits
06-05-2002, 07:08 PM
is it posibel to show the icon to "thread starter" and "last post" colom when it was a moderator that posts the post?
eeuh does anybody understand this, pff what is my englsich bad :paranoid: :nervous:
i attached an screenshot, maybe you understand dat :laugh:
Chris M
06-05-2002, 07:32 PM
Oh...
You mean you want the icon in the Last Post column if they are a Mod?
Satan
rascal
06-06-2002, 12:32 AM
Good Job and thanks for sharing!
Boofo
06-07-2002, 09:12 AM
Scott,
What do I need to do to have this in the privmsg template for private messages too? :)
Originally posted by PPN
This is a hack to show a small icon next to usernames on a post, when you mouse over you will also get told what rank they are, Admin, Super Mod or Moderator.
Add the following template
postbit_moderator_icon
<img src="{imagesfolder}/mod.gif" alt="$rank">
save the template
Edit the postbit template and place $mod_logo somewhere on it, i chose next to the username.
open up functions.php
look for
// do posts from ignored users
if (!$ignore[$post[userid]]) {
ABOVE it put
switch($post['usergroupid']) {
case "6";
$rank = "Administrator";
eval("\$mod_logo = \"".gettemplate("postbit_moderator_icon")."\";");
break;
case "5";
$rank = "Super Moderator";
eval("\$mod_logo = \"".gettemplate("postbit_moderator_icon")."\";");
break;
case "7";
$rank = "Moderator";
eval("\$mod_logo = \"".gettemplate("postbit_moderator_icon")."\";");
break;
default:
$mod_logo = "";
break;
}
save and upload functions.php
The hack will now work, but if you want to save on the extra query to the database to get the template.
Open showthread.php and add
,postbit_moderator_icon to the end of $templatesused you will have to do this twice.
attached is the mod logo i used
Boofo
06-07-2002, 09:25 AM
Where exactly would you add this in the getpostbit function? :)
Originally posted by PPN
switch($post['usergroupid']) {
case "6";
$rank = "Administrator";
$post[usertitle] = "<b>$post[usertitle]</b>";
break;
case "5";
$rank = "Super Moderator";
$post[usertitle] = "<b>$post[usertitle]</b>";
break;
case "7";
$rank = "Moderator";
$post[usertitle] = "<b>$post[usertitle]</b>";
break;
default:
$rank = "";
break;
}
use that code in your getpostbit function in /admin/functions.php
Martin64
07-16-2002, 11:53 PM
Installed and works great - exactly what I wanted. Thanks :)
PHiXTiT
09-13-2002, 03:45 AM
Great hack! (5 Stars)
I have modified this to add 3 different .gif files for each user group.
Mod, SuperMod, and Admin.
You can use your own .gif files or use the ones included.
All credit goes out to PPN! ;)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.