PDA

View Full Version : Administrative Tools Dropdown


Chris-777
29 Jan 2006, 22:33
Administrative Tools Dropdown Menu

What it does: Adds a dropdown menu visible only to the Administrator group for Admin tools and related links.

Time to install: 5 Minutes
Difficulty: Easy
Templates: 1
Phrases: 1

Step 1:

AdminCP -> Languages & Phrases -> Phrase Manager -> Add New Phrase
Phrase Type: Global
Product: vBulletin
Varname: navadmin
Text: Admin Tools

Step 2:

Style & Templates -> Style Manager -> (Your Style) -> Edit Templates -> Navigation / Breadcrumb Templates -> navbar

Find:

<td class="vbmenu_control"><a href="calendar.php$session[sessionurl_q]">$vbphrase[calendar]</a></td>

Add AFTER:


<!-- Admin Menu -->
<if condition="$show['admincplink']">
<if condition="$show['popups']">
<!-- start vBMenu control element -->
<td class="vbmenu_control" id="AdminMenu">
<a STYLE="text-decoration:none" href="#">$vbphrase[navadmin]</a>
<script type="text/javascript">
<!--
vbmenu_register("AdminMenu");
//-->
</script>
</td>
<!-- end vBMenu control element -->
</if>
</if>
<!-- /Admin Menu -->

Find:

<!-- / NAVBAR POPUP MENUS -->

Add ABOVE:


<!-- Admin Tools Menu Element -->
<if condition="$show['admincplink']">
<div class="vbmenu_popup" id="AdminMenu_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead">Admin Tools</span></td></tr>
<tr><td class="vbmenu_option"><a href="http://option1">First Option</a></td></tr>
<tr><td class="vbmenu_option"><a href="http://option2">Second Option</a></td></tr>
<tr><td class="vbmenu_option"><a href="http://option3">Third Option</a></td></tr>
</table>
</div>
</if>
<!-- /Admin Tools Menu Element -->

Change http://option1/2/3 to the full URL of the option you'd like to link. For example, if you wanted to put a link to the AdminCP in the dropdown, the code would be:


<tr><td class="vbmenu_option"><a href="http://www.yourdomain.tld/forum/admincp/index.php">Admin CP</a></td></tr>

"First/Second/Third Option" is simply the text displayed in the dropdown, edit it to suit whatever it is you're linking to. I personally don't use this for the AdminCP, but I find it useful for linking to PSIStats, Moderator Statistics and my VPS Server's Control Panel.

Screenshot attached.

Please Click https://www.vbulletin.org/forum/ (http://www.vbulletin.org/forum/vborg_miscactions.php?do=installhack&threadid=106658) if you are using this. Thanks!

Allan
30 Jan 2006, 00:13
Nice idea ;)

Lizard King
30 Jan 2006, 00:32
Just a quick question what is different then regular dynamic pop-up menus ?

Nothing

Chris-777
30 Jan 2006, 01:25
Just a quick question what is different then regular dynamic pop-up menus ?

Nothing

Well if you want to nitpick, the difference is the conditional, and the fact that I didn't see anything like this posted on here.

Not every hack has to be revolutionary dude. I find this handy, so I took the time to post it up and share it with the community. If this makes one single person's life easier, my time spent putting it together was well spent.

Tony G
30 Jan 2006, 02:31
Thanks for sharing your mod. Could you also attach your instructions in a .txt file? Thanks.

TTG
30 Jan 2006, 02:31
Simple but useful, thanks Chris-777
Clicked install

Chris-777
30 Jan 2006, 03:02
Thanks for sharing your mod. Could you also attach your instructions in a .txt file? Thanks.

Whoops! Pardon that, edited. :)

Trana
30 Jan 2006, 14:47
This is a great mini hack for those of us that can't do any of our own code.

I am using this as an option in my existing drop downs in order to get to my Administration forum:

<!-- Admin Menu -->
<if condition="in_array($bbuserinfo['usergroupid'], array(7))">
<tr><td class="vbmenu_option">
<a href="/forum/forumdisplay.php?f=3">Administration</a>
</td></tr>
</if>
<!-- /Admin Menu -->

However, it only works for members who are ONLY in the Moderator group (#7). It doesn't seem to work for the accounts that are both Admins and Moderators (6+7). Is there any way to fix this?

Thanks!

Chris-777
30 Jan 2006, 15:02
Yep, change:


<if condition="in_array($bbuserinfo['usergroupid'], array(7))">


To:


<if condition="in_array($bbuserinfo['usergroupid'], array(6, 7))">


:)

Chris-777
30 Jan 2006, 15:22
You can do it this way as well. I only use the array because of personal preference.

<if condition="$bbuserinfo['usergroupid'] == 6 OR $bbuserinfo['usergroupid'] == 7">

or
<if condition="is_member_of($bbuserinfo, 6, 7)">

Trana
30 Jan 2006, 16:40
The last one looks the cleanest.

Thanks again!

Chris-777
30 Jan 2006, 18:23
Anytime. :)

/me eyes the install button

Snake
30 Jan 2006, 21:10
Oh lovely!

GatorV
01 Feb 2006, 01:53
<!-- Admin Tools Menu Element -->
<div class="vbmenu_popup" id="AdminMenu_menu" style="display:none">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead">Admin Tools</span></td></tr>
<tr><td class="vbmenu_option"><a href="http://option1">First Option</a></td></tr>
<tr><td class="vbmenu_option"><a href="http://option2">Second Option</a></td></tr>
<tr><td class="vbmenu_option"><a href="http://option3">Third Option</a></td></tr>
</table>
</div>
<!-- /Admin Tools Menu Element -->

Won't this enable too see the links if they view source code, no matter what usergroup are no?

I ask this because I installed this to put a dropdown to some special search tools, and if anyone does right click and view source can get the links...

Chris-777
01 Feb 2006, 03:59
That's a great point, and wrapping the bottome code in a conditional is something I overlooked, thank you! This is a better way to do it.

Original post is updated with the new code.

To fix your existing navbar template:

Find:
<if condition="in_array($bbuserinfo['usergroupid'], array(7))">

Replace with:
<if condition="$show['admincplink']">

Find:
<!-- Admin Tools Menu Element -->

Add Below:

<if condition="$show['admincplink']">

Find:
<!-- /Admin Tools Menu Element -->

Add above:
</if>

Luggruff
06 Feb 2006, 10:34
hmm, now that the <if condition="in_array($bbuserinfo['usergroupid'], array(7))"> and such is gone, and I suck at coding.. how can I set more than the admin usergroup?
Like if I want it to show for moderators too.. (6 and 7)?
Or if I want a seperate menu for mods and one for admins?

Edit: Fixed.

Just replaced the <if condition="$show['admincplink']"> with <if condition="in_array($bbuserinfo['usergroupid'], array(7))"> again. No one can see the code anyways now. Just the <!-- Admin content menu --> but nothing in between.

Omranic
07 Feb 2006, 12:40
nice