User:Results template tag
The User:Results tag allows you to return the search results from usage of the User:Search tag. It's output behaves similar to the User:Users tag.
{exp:user:results} content {/exp:user:results}
Parameters
Most of the parameters available in the User:Users tag are available here.
Variables
Most of the variables available in the User:Users tag are available here. Additionally, these exist as well:
keywords
{keywords}
This variable returns the keyword(s) that were searched. This variable can also be used outside of the User:Results tag.
total_results
{total_results}
This' variable returns the total amount of results returned for the keyword(s) searched. This variable can also be used outside of the User:Results tag.
Variable Pairs
The following variable pairs are available for use:
user_paginate
{user_paginate}
<li>
Page {user_current_page} of
{user_total_pages} pages
{user_pagination_links}
</li>
{/user_paginate}
OR
{user_paginate}
<ul class="pagination">
{user_pagination_links}
{first_page}
<li><a href="{pagination_url}">First</a></li>
{/first_page}
{previous_page}
<li><a href="{pagination_url}">« Previous</a></li>
{/previous_page}
{page}
<li{if current_page} class="active"{/if}><a href="{pagination_url}">{pagination_page_number}</a></li>
{/page}
{next_page}
<li><a href="{pagination_url}">Next »</a></li>
{/next_page}
{last_page}
<li><a href="{pagination_url}">Last</a></li>
{/last_page}
{/user_pagination_links}
</ul>
{/user_paginate}
Pagination is available for this tag and works just like regular EE pagination, but each variable/variable pair is prepended with user_ (except for any variables and variable pairs inside of the user_pagination_links variable pair). Used in conjunction with the paginate parameter.
Conditionals
In addition to most of the variables above being available for use as conditionals, the following conditional is available for use:
user_no_results
{if user_no_results}
Sorry, no results were found.
{/if}
This conditional displays its contents when there are no results found.
Form Fields
Most of the form fields available in the User:Users tag are available here.
Examples
The below example will show search results, and will display a search form below the results to search within those results.
<h2>
{total_results} results for: {keywords}
</h2>
{exp:user:results}
<h3>{screen_name}</h3>
<p>{location}, {CUSTOM_MEMBER_FIELD}</p>
{/exp:user:results}
{exp:user:search
return="user/results"
}
<h2>Search Again?</h2>
<p>
<input type="text" name="keywords" />
<label>
<input type="checkbox" name="search_within_results" value="yes" />
Search within results?
</label>
<button type="submit">Search</button>
</p>
{/exp:user:search}