• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Search function for guests

ibaker

Well-known member
#1
I am trying to entice more guests to register on my site and if they are registered it may entice them to post. One thing I would like to do is have the search function done in a way that when a guest tries to use the search function, they are taken to the login or register page.

I know I can turn the search off for guests in the permissions however that takes the search box off the navbar which I don't want as it that won't entice users to register.

So does anyone have an idea of what code I would need to put in what template to facilitate what I would like to happen?

Thanks
 

Jake Bunce

XenForo moderator
Staff member
#4
You could remove the condition around the search_bar in the templates:

Admin CP -> Appearance -> Templates -> header

Code:
<xen:hook name="header">
<div id="header">
	<xen:include template="logo_block" />
	<xen:include template="navigation" />
	<xen:if is="{$canSearch}"><xen:include template="search_bar" /></xen:if>
</div>
</xen:hook>
 

ibaker

Well-known member
#5
That worked perfectly Jake...thanks to you Mate!

The search bar is still displayed to Guest users but when they try to use it, they are met with a login or register page. Note, I don't have the "Search Forums" sub menu item on my site as I needed the real estate plus it is duplicated on the quick search drop down anyway so I don't have to worry about that link with the above code...thanks again Jake!