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

Search function for guests

Discussion in 'Styling and Customization Questions' started by ibaker, Oct 3, 2012.

  1. ibaker

    ibaker Well-Known Member

    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?

    Stormlilly likes this.
  2. Digital Doctor

    Digital Doctor Well-Known Member

    Or ... ideally .... it might prompt to register after 2 searches.
    That being said, forum searching sucks :)
    Stormlilly likes this.
  3. Digital Doctor

    Digital Doctor Well-Known Member

    What are the top 10 things guests search for ?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You could remove the condition around the search_bar in the templates:

    Admin CP -> Appearance -> Templates -> header

    <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>
    ibaker likes this.
  5. ibaker

    ibaker Well-Known Member

    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!

Share This Page