I'm a web developer who works with HTML, PHP, CSS, ExpressionEngine, Javascript, jQuery, MySQL, SEO and UI/UX design. Always looking to learn new web related stuff, and a bit of a PC gamer. You can also find me on Twitter and LinkedIn.

Posts Tagged: search

Text

Some settings can be an absolute nightmare to find in the Expression Engine Control Panel, and the setting for how often a user can search your site is one of them.

By default, these are the restrictions on the search priveleges for member groups:

  • Admins = No restriction
  • Members = 10 seconds
  • Guests = 15 seconds
  • Pending = 15 seconds
  • Banned = 60 seconds

In order to change these, you’ll need to go to:

Admin > Members and Groups > Member Groups > Edit Group > Search Privileges

There you’ll find ‘Number of seconds between searches’. Change this and the selected user group will then be able to search however many times you want.

Hopefully you can now avoid that awful grey box telling the user “You are only allowed to search every 15 seconds”.

Text

Using the {exp:query} tag in the licensed version of ExpressionEngine, you can pull the most recent searches performed by your users. The snippet below pulls the last 3 searches that returned a result, and links to the relevant search results page:

<ul class="recentsearches">
{exp:query sql="SELECT * FROM exp_search WHERE total_results > 0
ORDER BY RAND() DESC LIMIT 3"}
<li><a href="{path=search/results}{search_id}">{keywords}</a></li>
{/exp:query}
</ul>