Back to vBulletin 4 Articles

Navtab Search Box with Options (How-To-Guide)
by 8thos 26 Jun 2011

In this guide you will learn how to:
  1. Create search navtab across all skins.
  2. Remove search from navbar.
  3. Disable search box for guests.
  4. Increase rate of accidental ad clicks due to search being right above ads.
  5. Do it in under 2 minutes.






I got the Plugin PHP code by modifying both Forum Display and Group Search.

If you have a lot of traffic and don't want guests slowing down your site, you can disable search for guests.

I created the plugin using Allan's Guide:
[HOW TO - vB4] How add sub-menu drop down to the navbar (tab Forum)

1. AdminCP/Plugins & Products/Add New Plugin

2. Product: vBulletin

3. Hook Location: process_templates_complete

4. Title: Search

5. Execution Order: 5

Plugin PHP Code:
The code in green is where you can disable search for guests.
The code in red is where you can move the template hook per Allan's guide

Code:
// change $allowguests from 'true' to 'false' if you do NOT want guests to see the gallery menu
	$allowguests = false; 
/******** NO EDITS below here! ************/
/******************************************/
if ($show['member'] OR $allowguests)
{
	global $vbphrase, $vbulletin, $bbuserinfo;
	$sess = $vbulletin->session->vars['sessionurl_q'];
$template_hook['navbar_after_community'] .= ' 
<li class="popupmenu nohovermenu forumsearch menusearch" id="forumsearch">
				<h6><a href="javascript://" class="popupctrl">Search</a></h6>
				<form action="search.php?do=process" method="get">
					<ul class="popupbody popuphover">
						<li><input type="text" class="searchbox" name="query" value="Search..." tabindex="1" /></li>
						<li class="formsubmit">
							<input type="submit" class="button" value="Search" tabindex="2" />
						</li>
					<li class="formsubmit">
						<div class="submitoptions">
							<label><input type="radio" name="showposts" value="0" checked="checked" /> Show Threads</label>
							<label><input type="radio" name="showposts" value="1" /> Show Posts</label>
						</div>
						<div class="advancedsearchlink"><a href="search.php?">Advanced Search</a></div>
					</li>
				</ul>
				<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
				<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
				<input type="hidden" name="do" value="process" />
				<input type="hidden" name="contenttype" value="vBForum_Post" />
				<input type="hidden" name="exactname" value="1" />
				</form>
			</li>
';
}
To remove search from the navbar:

AdminCP/Styles and Templates/ Style Manager / Edit Templates / Navigation and Breadcrumb Templates / navbar

In navbar delete the following code:

[code]To remove search from the navbar:

AdminCP/Styles and Templates/ Style Manager / Edit Templates / Navigation and Breadcrumb Templates / navbar

In navbar delete the following code:

Code:
<vb:if condition="$vboptions['enablesearches']">
    <div id="globalsearch" class="globalsearch">
        <form action="search.php?{vb:raw session.sessionurl}do=process" method="post" id="navbar_search" class="navbar_search">
            <vb:comment><input type="hidden" name="s" value="{vb:raw session.sessionurl}" /></vb:comment>
            <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
            <input type="hidden" name="do" value="process" />
            <span class="textboxcontainer"><span><input type="text" value="" name="query" class="textbox" tabindex="99"/></span></span>
            <span class="buttoncontainer"><span><input type="image" class="searchbutton" src="{vb:stylevar imgdir_button}/search<vb:if condition="$stylevar['textdirection'] == 'rtl'">_rtl</vb:if>.<vb:if condition="(is_browser('ie') AND !is_browser('ie', 7) AND !is_browser('ie', 8))">gif<vb:else />png</vb:if>" name="submit" onclick="document.getElementById('navbar_search').submit;" tabindex="100"/></span></span>
        </form>
        <ul class="navbar_advanced_search">
            <li><a href="search.php{vb:raw session.sessionurl_q}" accesskey="4">{vb:rawphrase advanced_search}</a></li>
        </ul>
    </div>
    </vb:if>
Hit save.

You're done.
Attached Thumbnails
Click image for larger version
Name:	searchgone.jpg
Views:	2137
Size:	85.4 KB
ID:	130410   Click image for larger version
Name:	searchplugin.jpg
Views:	883
Size:	140.6 KB
ID:	130411  

Similar Mods

Mini Mods Navbar Search Form/Input Box with Advanced Options Dropdown vBulletin 3.6 Template Modifications
Boolean Search as Default in Advanced Search Options vBulletin 3.5 Template Modifications

vblts.ru supports vBulletin®, 2022-2024