get_users
{get_users} is used to include your desired users into the array. You have handful of parameters at your disposal.
Usage
{get_users parameters}
It can use following parameters
Parameter Name | Options |
assign | Store the result(Array) to this variable |
ban | Check user ban status:
|
category | Specific category users. Multiple categories should be separated with comma ‘,’:
|
count_only | Set to true if you only want to count result:
|
date_span | Get users for specific time frame:
|
email | Get user of provided email:
|
exclude | Exclude user from result:
|
featured | Get featured users:
|
gender | Get users of specific gender:
|
level | Get users of specific level:
|
limit | Number of results you want:
|
order | Sort your result. You also need to tell how to order your result. asc OR desc, e.g ‘username desc’
|
| |
status | Check your user status:
|
userid | Get user of provided ID:
|
username | Get user of provided username:
|
Example 1
{get_users assign=month_users date_span="this_month " status="Ok" order=" doj asc"}
Above code will get users of current month but only those with status of “Ok” and order according to their date-of-joined from oldest to latest. Function returned an array which is stored in {$month_users} variable. Time to loop through array and display our users.
{section name=mon_urs from=$month_users}
{include file="$style_dir/blocks/user.html" user=$month_users[mon_usrs]}
{/section}
[post_link id=”199″] and [post_link id=”237″]
Example 2
{get_users assign=featured_user limit=1 featured="yes" order=RAND()}
This code will get 1 featured user randomly out of all featured users. To display see following code
{section name=feat_user from=$featured_user}
{include file="$style_dir/blocks/user.html" user=$featured_user[feat_user]}
{/section}
Loading...

Last modified 1yr ago