- Compatible XF 2.x versions
- 2.x
Conditional Statements for XenForo 2
The conditional statements can be expanded by using AND, OR conditional statements operators and using xf:if, xf:else, xf:elseif.
If there are any conditional statements that you want to add, please add it as a message and the article will be updated.
1. How can I show content to Administrators?
2. How can I show content to Moderators?
3. How can I show content to Administrators and Moderators?
4. How can I Show content for member?
5. How can I Show content if not a member?
6. How can I show different content to members and guests?
7. How can I Show content for banned members?
8. How can I show content from x if the user's likes is bigger?
9. How can I show content from x if the user's message is bigger?
10. How can I show content from x if the user's points is bigger?
11. How can I show content to a specific member?
12. How can I show content to more than one member?
The conditional statements can be expanded by using AND, OR conditional statements operators and using xf:if, xf:else, xf:elseif.
If there are any conditional statements that you want to add, please add it as a message and the article will be updated.
1. How can I show content to Administrators?
Code:
<xf:if is="$xf.visitor.is_admin">
Show content...
</xf:if>
Code:
<xf:if is="$xf.visitor.is_moderator">
Show content...
</xf:if>
Code:
<xf:if is="$xf.visitor.is_admin OR $xf.visitor.is_moderator">
Show content...
</xf:if>
Code:
<xf:if is="$xf.visitor.user_id">
Show content...
</xf:if>
Code:
<xf:if is="!$xf.visitor.user_id">
Show content...
</xf:if>
Code:
<xf:if is="!$xf.visitor.user_id">
Show only members
<xf:else />
Show only guests
</xf:if>
Code:
<xf:if is="$user.is_banned">
Show content...
</xf:if>
Code:
<xf:if is="$user.like_count|number > x">
Show content...
</xf:if>
Code:
<xf:if is="$user.message_count|number > x">
Show content...
</xf:if>
Code:
<xf:if is="$user.trophy_points|number > x">
Show content...
</xf:if>
Code:
<xf:if is="$xf.visitor.user_id == x">
Show content...
</xf:if>
Code:
<xf:if is="in_array($xf.visitor.user_id, [x, x, x, x])">
Show content...
</xf:if>