x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Recent Searches

Question:

How can I show recent searches performed on the site?

Answer:

Thanks to Lynda for the answer.

{exp:query sql="SELECT * FROM exp_search order by search_date desc limit 10"}
<a href="{path=search/results}{search_id}">{keywords}</a> ({total_results} Results)<br />
{/exp:query}

You can also restrict it to searches that members have performed:

{exp:query sql="SELECT * FROM exp_search, exp_members where exp_search.member_id = exp_members.member_id
order by exp_search.search_date desc limit 10"
}
<a href="{path=search/results}{search_id}">{keywords}</a> ({total_results} Results) by {screen_name}<br />
{/exp:query}

You can change the path if you renamed the search templates, etc.

Source, Thread

Category:Templates

Categories: