PDA

View Full Version : Forum Home Enhancements - Moderator Column Javascript Menu


rukia
09-14-2008, 10:00 PM
This hack will change the moderator column previewed on forum home and on subforums into a clickable javascript menu using vBulletin's own menu control API. Each moderator will have it's own column in the menu, and will be a clickable link leading to the moderator's profile page; in addition, there will be a link to allow the user easy access to send a new PM. This hack will automatically use the old style moderator column separated by commas if the viewer's browser has javascript disabled. :)

Demo: http://www.giveupalready.com/index.php

Included in the post is the image for the Send PM button, you will need to place it in your images/buttons directory for it to work.

First, find and open up forumhome_forumbit_level1_post and locate:

<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
</if>

You want to replace the previous lines with:

<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1">
<if condition="$show['popups']">
<if condition="$forum[moderators]">
<div id="moderators$forum[forumid]" class="smallfont">
<a href="#"><strong>Moderators</strong></a>
<script type="text/javascript">
vbmenu_register("moderators$forum[forumid]");
</script>
</div>
<div class="vbmenu_popup" id="moderators$forum[forumid]_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead">$forum[title] Moderators</td></tr>
$forum[moderators]
</table>
</div>
</if>
<else />
<div class="smallfont">$forum[moderators]</div>
</if>
</td>
</if>

Now find forumhome_forumbit_level2_post and locate the following lines:

<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
</if>

You want to replace those lines with the following code:

<if condition="$vboptions['showmoderatorcolumn']">
<td class="alt1">
<if condition="$show['popups']">
<if condition="$forum[moderators]">
<div id="moderators$forum[forumid]" class="smallfont">
<a href="#"><strong>Moderators</strong></a>
<script type="text/javascript">
vbmenu_register("moderators$forum[forumid]");
</script>
</div>
<div class="vbmenu_popup" id="moderators$forum[forumid]_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead">$forum[title] Moderators</td></tr>
$forum[moderators]
</table>
</div>
</if>
<else />
<div class="smallfont">$forum[moderators]</div>
</if>
</td>
</if>

Now for the final step, open up forumhome_moderator and delete the code in there. Replace it with the following:

<if condition="$show['popups']">
<tr><td class="vbmenu_option"><div class="smallfont" style="float: left" /><a href="member.php?$session[sessionurl]u=$moderator[userid]">$moderator[musername]</a></div><div style="float: right" /><a href="private.php?$session[sessionurl]do=newpm&amp;u=$moderator[userid]" rel="nofollow"><img src="$stylevar[imgdir_button]/sendpm.png" alt="<phrase 1="$moderator[username]">$vbphrase[send_private_message_to_x]</phrase>" border="0" /></a></div></td></tr>
<else />
<if condition="$show['comma_leader']">, </if><a href="member.php?$session[sessionurl]u=$moderator[userid]">$moderator[musername]</a>
</if>

If you do not wish to use an image for Send PM, change:

<img src="$stylevar[imgdir_button]/sendpm.png" alt="<phrase 1="$moderator[username]">$vbphrase[send_private_message_to_x]</phrase>" border="0" />

To your text of choice.

If you followed these steps correctly, you should now be able to click "Moderators" in the moderator column to open a javascript menu similar to the ones featured in your very own forum. :)

If you want to disable the arrow icon associated with the menu, locate vbmenu_register("moderators$forum[forumid]"); and change it to vbmenu_register("moderators$forum[forumid]",true);


- September 15:
Added: Send PM link next to moderator username.

SEOvB
09-15-2008, 01:37 AM
nice addition

haothiencz
09-15-2008, 06:18 AM
Good idea, ;)

RvG2
09-15-2008, 02:00 PM
cool! thanks for sharing!

RobbieZ
09-15-2008, 03:25 PM
Makes it look more professional. I like it.

rukia
09-15-2008, 05:47 PM
Updated to include a "Send PM" link next to the moderator's name, image for the button is included in the post, but you may opt to use your own; demo has been updated to reflect the addition.