The if template tag can be used for conditional rendering. The if tag can take the following attributes:
The is attribute supports several logical operators:
Tag The else and else-if tags are used in conjunction with the if tag to conditionally display HTML as per the sentence.
The For-each Tag
The for-each tag allows you to loop through an array of elements, printing an HTML block for each element.
The for-each tag accepts the following attributes:
How can I display moderator-only content in Xenforo?
How can I display content for admins and moderators only in Xenforo?
How can I display content for admins or moderators only in Xenforo?
How can I display specific content for administrators and users in Xenforo?
How can I display specific content for admins, moderators and users in Xenforo?
How can I show content to registered users only and hide it from guests in Xenforo?
How can I show guest-only content and hide it from registered users in Xenforo?
How can I display different content for guests and registered users in Xenforo?
How can I display content only for a specific user in Xenforo?
How can I display content only for specific users in Xenforo?
How can I only hide content for a specific user in Xenforo?
How can I hide content from specific users in Xenforo?
How can I display content only for a user with a specific username in Xenforo?
How can I display content only for users with specific usernames in Xenforo?
How can I display content only for users who have an avatar or gravatar in Xenforo?
How can I display content for users who have less than x posts in Xenforo?
How can I display content for users who have more than x posts in Xenforo?
If you want to display text only for a forum command in Xenforo
If you want to display text for blocked users in Xenforo
If you want to display text to an unwanted user in Xenforo
How can I display content only to certain user groups in Xenforo?
How can I hide content from certain user groups in Xenforo?
How can I display content to multiple specific user groups in Xenforo?
How can I hide content from multiple groups in Xenforo?
How can I display content for multiple specific users in Xenforo?
How can I display content for users who have zero posts in Xenforo?
How can I display content only for users who have not verified their email address in Xenforo?
How can I display content only for visible users in Xenforo?
How can I display content only for users who don't have an avatar in Xenforo?
How can I only show content to users who have Gravatar in Xenforo?
How can I display content for users who have zero likes in Xenforo?
How can I display content for users who have zero reactions in Xenforo?
How can I display information only for users who have less than X likes in Xenforo?
How can I display information only for users who have less than X reactions in Xenforo?
How can I display information only for users who have more than X likes in Xenforo?
How can I display information only for users who have more than X reactions in Xenforo?
How can I display content for users who have zero trophy points in Xenforo?
How can I display information only for users who have less than X trophy points in Xenforo?
How can I display information only for users who have more than X trophy points in Xenforo?
How can I display different information only for users who have more than 0 trophy points, less than X trophy points and more than X trophy points in Xenforo?
How can I display content for users who have zero posts, more than X and less than X posts in Xenforo?
How can I display content for users who have zero likes, more than X likes, and less than X likes in Xenforo?
How can I display content for users who have zero reactions, more than X reactions, and less than X reactions in Xenforo?
How to draw a conclusion for users who do not have the Address (Location) field filled in Xenforo?
How to draw a conclusion for users who have the Address (Location) field filled in Xenforo?
How to display output for users who have the Website field filled in Xenforo?
How to make a withdrawal for users who do not have the Website field filled in Xenforo?
How to draw a conclusion for users who have a completed signature in Xenforo?
How to make a withdrawal for users who have no signature in Xenforo?
Activated Users:
Pending email confirmation:
Pending email confirmation (after editing):
Invalid mail:
Pending approval:
Rejected:
Disabled:
Conditions:
If you want to display text in a specific style in Xenforo
If you want to display text in certain styles in Xenforo
Output with Russian
Output for Russian and other languages
Output for Russian and English, and different text for others
With conditions
And another little feature with the language, when exporting a localized language in an .xml file, you can also find the installed code for the language
. There are also some features for the language id:
How can I display the number of likes from a particular topic in Xenforo?
How can I display content only for those users who have an additional field filled in Xenforo?
Skype extra field:
Additional facebook field:
Additional twitter field:
For boys
For girls
Occupation:
Floor conditions:
For language ID 1:
For language ID 1 and other languages:
For language with ID 1, 2:
For language ID 1, 2 and other languages:
With conditions:
How can I hide text from the forum team in Xenforo?
How can I display super admin-only content in Xenforo?
How can I display content in a specific forum in Xenforo?
How can I display content in forum x and y in Xenforo?
How can I display content in a specific category in Xenforo?
How can I hide content in a specific category in Xenforo?
How can I display content in specific categories in Xenforo?
Correctly insert "your html" after any message on each page (except for personal correspondence)
(Please note that messages are numbered from zero!):
After the second post on each page in Xenforo:
Random (random) display in Xenforo:
How can I display content for users registered less than 30 days in Xenforo?
How can I display content for users who have been registered for more than 30 days in Xenforo?
How can I display content in a topic author's post in Xenforo?
How can I display content after the first post in a topic in Xenforo?
How can I display the content after post x on every page of a forum topic or conversation in Xenforo?
How can I display content after x posts on each forum topic page in Xenforo?
How can I display the content after post x on every forum topic page in Xenforo?
How can I display content after the first post in a thread or conversation in Xenforo?
How can I display content after post x on every page, only in forums y and z in Xenforo?
How can I display the content after the x post on every page except for the y and z forums in Xenforo?
How can I display content in a specific forum topic in Xenforo?
How can I display content in a specific post in Xenforo?
How can I display content in multiple specific posts in Xenforo?
How can I display content other than a specific message in Xenforo?
How can I display content other than a few specific messages in Xenforo?
How can I display content across multiple forum topics in Xenforo?
How can I display content other than a specific forum topic in Xenforo?
How can I display content other than a few forum topics?
How can I display content only in author x topics in Xenforo?
If you want to display the given text in a section on the first page only (forum_view template or where there is a PAGINATION)
How can I display content on a specific page in Xenforo?
How can I display content on specific pages in Xenforo?
How can I display content other than a specific page in Xenforo?
How can I hide a message in a specific template in Xenforo?
How can I display content other than certain pages in Xenforo?
How can I only show content when creating a topic in Xenforo?
How can I only hide content when creating a theme in Xenforo?
How can I show the content only when creating a resource in Xenforo?
How can I only hide content when creating a resource in Xenforo?
How can I show content only when viewing a search page in Xenforo?
How can I hide content only when viewing a search page in Xenforo?
How can I only show content when viewing "What's New" in Xenforo?
How can I hide content only when viewing the What's New page in Xenforo?
How can I show content only when viewing conversations in Xenforo?
How can I hide content only when viewing conversations in Xenforo?
How can I show content only when viewing a list of conversations in Xenforo?
How can I hide content only when viewing a list of conversations in Xenforo?
How can I show content only when galleries are on the main page in Xenforo?
How can I hide content only when galleries are on the main page in Xenforo?
How can I show content only when resources are on the main page in Xenforo?
How can I hide content only when resources are on the main page in Xenforo?
How can I show content only when viewing a resource in Xenforo?
How can I hide content only when viewing a resource in Xenforo?
How can I show content only when viewing a topic in Xenforo?
How can I show content only when viewing a forum in Xenforo?
How can I hide content only when viewing a forum in Xenforo?
How to draw a conclusion for users who have a non-standard rank filled in Xenforo?
How to draw a conclusion for users who do not have a custom rank filled in Xenforo?
How to draw output for users with specific time zone in Xenforo?
Moscow
London
With conditions
How to make a withdrawal for users with a certain amount of warning points in Xenforo?
0 warning points
Less than x warning points
More than x warning points
With conditions:
How can I display content to a user on their birthday in Xenforo?
How to draw a conclusion for users who have information about themselves in Xenforo?
How to draw a conclusion for users who do not have information about themselves in Xenforo?
How can I display the current year in Xenforo?
How can I show content on pages with a sidebar in Xenforo?
How can I output an array of names in Xenforo?
How can I display postbit information for hidden messages in Xenforo?
How can I display postbit information for all visible posts in Xenforo?
How can I display a message on a specific resource in Xenforo?
How can I display a message in certain resources in Xenforo?
How to remove the "Complaint" button in the user's personal account against himself in Xenforo?
Create modification - /admin.php?template-modifications/add
Template: member_view
Find:
- is - The condition under which the content of the tags should be displayed.
Conditions : |
- OR - Boolean or. Alternative usage: ||
- AND - Logical and. Alternative usage of &&
- ! - Logical negation (not).
- XOR - Returns true if only one of the two conditions is true. exclusive or
Tag The else and else-if tags are used in conjunction with the if tag to conditionally display HTML as per the sentence.
The For-each Tag
The for-each tag allows you to loop through an array of elements, printing an HTML block for each element.
The for-each tag accepts the following attributes:
- loop - The array to loop.
- key is the name of the variable used in the loop to get the array key of the current element. Can be an integer (regular array) or a string (associative array).
- value is the name of the variable to use in the loop, containing the current element of the array.
- i - The name of the variable to use in the loop for the current index. Optional attribute
Code:
<xf:if is="{$xf.visitor.is_admin}">
This text is only visible to admins.
</xf:if>
How can I display moderator-only content in Xenforo?
Code:
<xf:if is="{$xf.visitor.is_moderator}">
This text is only visible to moderators.
</xf:if>
How can I display content for admins and moderators only in Xenforo?
Code:
<xf:if is="{$xf.visitor.is_admin} AND {$xf.visitor.is_moderator}">
This text is only visible to admins and moderators.
</xf:if>
How can I display content for admins or moderators only in Xenforo?
Code:
<xf:if is="{$xf.visitor.is_admin} OR {$xf.visitor.is_moderator}">
This text is only visible to admins and moderators.
</xf:if>
How can I display specific content for administrators and users in Xenforo?
Code:
<xf:if is="$xf.visitor.is_admin">
This text is only visible to the administrator...
<xf:else />
This text is visible to anyone who is not an administrator
</xf:if>
How can I display specific content for admins, moderators and users in Xenforo?
Code:
<xf:if is="$xf.visitor.is_admin">
This text is only visible to the administrator...
<xf:elseif is="$xf.visitor.is_moderator" />
This text will only be shown to moderators (excluding users who are also administrators).
<xf:else />
This text is visible to anyone who is not an Administrator or Moderator.
</xf:if>
How can I show content to registered users only and hide it from guests in Xenforo?
Code:
<xf:if is="{$xf.visitor.user_id}">
This text is only visible to registered users.
</xf:if>
How can I show guest-only content and hide it from registered users in Xenforo?
Code:
<xf:if is="!{$xf.visitor.user_id}">
This text is only visible to guests.
</xf:if>
How can I display different content for guests and registered users in Xenforo?
Code:
<xf:if is="{$xf.visitor.user_id}">
This text is only visible to registered users.
<xf:else />
This text is only visible to guests.
</xf:if>
How can I display content only for a specific user in Xenforo?
Code:
<xf:if is="{$xf.visitor.user_id} == x">
This text is only visible to user x
</xf:if>
How can I display content only for specific users in Xenforo?
Code:
<xf:if is="in_array({$xf.visitor.user_id}, ([x,y,z]))">
This text is only visible to user x,y,z
</xf:if>
How can I only hide content for a specific user in Xenforo?
Code:
<xf:if is="{$xf.visitor.user_id} != x">
This text is visible to users other than x
</xf:if>
How can I hide content from specific users in Xenforo?
Code:
<xf:if is="!in_array({$xf.visitor.user_id}, ([x, y]))">
This text is only visible to users other than x, y
</xf:if>
How can I display content only for a user with a specific username in Xenforo?
Code:
<xf:if is="{{ $xf.visitor.username == 'username' }}">
This text is only visible to the user named username
</xf:if>
How can I display content only for users with specific usernames in Xenforo?
Code:
<xf:if is="{{ in_array($xf.visitor.username, ['username', 'Captain', 'Hope', 'Mirovinger']) }}">
This text is only visible to a user named username, Captain, Hope, or Mirovinger
</xf:if>
How can I display content only for users who have an avatar or gravatar in Xenforo?
Code:
<xf:if is="{$xf.visitor.avatar_date} OR {$xf.visitor.gravatar}">
This content can only be seen by users who have set their avatar or gravatar
</xf:if>
How can I display content for users who have less than x posts in Xenforo?
Code:
<xf:if is="{$xf.visitor.message_count} < x">
This text will only be shown to users with less than x posts
</xf:if>
How can I display content for users who have more than x posts in Xenforo?
Code:
<xf:if is="{$xf.visitor.message_count} > x">
This text will only be shown to users who have more than x posts
</xf:if>
If you want to display text only for a forum command in Xenforo
Code:
<xf:if is="{$xf.visitor.is_staff}">
This text is visible only to members of the forum team.
</xf:if>
If you want to display text for blocked users in Xenforo
Code:
<xf:if is="{$xf.visitor.is_banned}">
This text is only visible to blocked users.
</xf:if>
If you want to display text to an unwanted user in Xenforo
Code:
<xf:if is="{$xf.visitor.Option.is_discouraged}">
This text is visible only to unwanted users.
</xf:if>
How can I display content only to certain user groups in Xenforo?
Code:
<xf:if is="{$xf.visitor.isMemberOf(x)}">
This text is visible only to users from group x
</xf:if>
How can I hide content from certain user groups in Xenforo?
Code:
<xf:if is="!{$xf.visitor.isMemberOf(x)}">
This text is hidden from users from group x
</xf:if>
How can I display content to multiple specific user groups in Xenforo?
Code:
<xf:if is="{$xf.visitor.isMemberOf([x, y])}">
This text is visible only to users from groups x and/or y
</xf:if>
How can I hide content from multiple groups in Xenforo?
Code:
<xf:if is="!{$xf.visitor.isMemberOf([x, y])}">
This text is not visible only to users from groups x and/or y
</xf:if>
How can I display content for multiple specific users in Xenforo?
Code:
<xf:if is="in_array({$xf.visitor.user_id}, ([x, y, z]))">
This text is only visible to users x, y and z
</xf:if>
How can I display content for users who have zero posts in Xenforo?
Code:
<xf:if is="{$xf.visitor.message_count} == 0">
This text will be shown to users with 0 posts
</xf:if>
How can I display content only for users who have not verified their email address in Xenforo?
Code:
<xf:if is="{$xf.visitor.isAwaitingEmailConfirmation()}">
This text will only be shown to users who have not verified their email address.
</xf:if>
How can I display content only for visible users in Xenforo?
Code:
<xf:if is="$xf.visitor.visible">
Only visible users can view this content
</xf:if>
How can I display content only for users who don't have an avatar in Xenforo?
Code:
<xf:if is="!{$xf.visitor.avatar_date} OR !{$xf.visitor.gravatar}">
This content can only be seen by users who do not have an avatar
</xf:if>
How can I only show content to users who have Gravatar in Xenforo?
Code:
<xf:if is="{$xf.visitor.gravatar}">
This content can only be seen by users who have Gravatar installed
</xf:if>
How can I display content for users who have zero likes in Xenforo?
Code:
<xf:if is="{$xf.visitor.like_count} == 0">
This text will be shown to users with 0 likes
</xf:if>
How can I display content for users who have zero reactions in Xenforo?
Code:
<xf:if is="{$xf.visitor.reaction_score} == 0">
This text will be shown to users with 0 reactions
</xf:if>
How can I display information only for users who have less than X likes in Xenforo?
Code:
<xf:if is="{$xf.visitor.like_count} < x">
This text will only be shown to users with less than x likes
</xf:if>
How can I display information only for users who have less than X reactions in Xenforo?
Code:
<xf:if is="{$xf.visitor.reaction_score} < x">
This text will only be shown to users with less than x reactions
</xf:if>
How can I display information only for users who have more than X likes in Xenforo?
Code:
<xf:if is="{$xf.visitor.like_count} > x">
This text will only be shown to users with more than x likes
</xf:if>
How can I display information only for users who have more than X reactions in Xenforo?
Code:
<xf:if is="{$xf.visitor.reaction_score} > x">
This text will only be shown to users with more than x reactions
</xf:if>
How can I display content for users who have zero trophy points in Xenforo?
Code:
<xf:if is="{$xf.visitor.trophy_points} == 0">
This text will be shown to users with 0 trophy points
</xf:if>
How can I display information only for users who have less than X trophy points in Xenforo?
Code:
<xf:if is="{$xf.visitor.trophy_points} < x">
This text will only be shown to users with less than x trophy points
</xf:if>
How can I display information only for users who have more than X trophy points in Xenforo?
Code:
<xf:if is="{$xf.visitor.trophy_points} > x">
This text will only be shown to users who have more than x trophy points
</xf:if>
How can I display different information only for users who have more than 0 trophy points, less than X trophy points and more than X trophy points in Xenforo?
Code:
<xf:if is="{$xf.visitor.trophy_points} == 0">
This text will be shown to users with 0 trophy points
<xf:elseif is="{$xf.visitor.trophy_points} < x" />
This text will only be shown to users with less than x trophy points
<xf:elseif is="{$xf.visitor.trophy_points} > x" />
This text will only be shown to users who have more than x trophy points
</xf:if>
How can I display content for users who have zero posts, more than X and less than X posts in Xenforo?
Code:
<xf:if is="{$xf.visitor.message_count} == 0">
This text will be shown to users with 0 posts
<xf:elseif is="{$xf.visitor.message_count} < x" />
This text will only be shown to users who have more than x posts
<xf:elseif is="{$xf.visitor.message_count} > x" />
This text will only be shown to users with less than x posts
</xf:if>
How can I display content for users who have zero likes, more than X likes, and less than X likes in Xenforo?
Code:
<xf:if is="{$xf.visitor.like_count} == 0">
This text will be shown to users with 0 likes
<xf:elseif is="{$xf.visitor.like_count} < x" />
This text will only be shown to users with less than x likes
<xf:elseif is="{$xf.visitor.like_count} > x" />
This text will only be shown to users with more than x likes
</xf:if>
How can I display content for users who have zero reactions, more than X reactions, and less than X reactions in Xenforo?
Code:
<xf:if is="{$xf.visitor.reaction_score} == 0">
This text will be shown to users with 0 reactions
<xf:elseif is="{$xf.visitor.reaction_score} < x" />
This text will only be shown to users with less than x reactions
<xf:elseif is="{$xf.visitor.reaction_score} > x" />
This text will only be shown to users with more than x reactions
</xf:if>
How to draw a conclusion for users who do not have the Address (Location) field filled in Xenforo?
Code:
<xf:if is="!{$xf.visitor.location}">
This text will only be visible to visitors who do not have a location filled in.
</xf:if>
How to draw a conclusion for users who have the Address (Location) field filled in Xenforo?
Code:
<xf:if is="{$xf.visitor.location}">
This text will only be visible to visitors who have a location filled in
</xf:if>
How to display output for users who have the Website field filled in Xenforo?
Code:
<xf:if is="{$xf.visitor.website}">
This text will only be visible to visitors who have a completed website
</xf:if>
How to make a withdrawal for users who do not have the Website field filled in Xenforo?
Code:
<xf:if is="!{$xf.visitor.website}">
This text will only be visible to visitors who do not have a completed website
</xf:if>
How to draw a conclusion for users who have a completed signature in Xenforo?
Code:
<xf:if is="{$xf.visitor.signature}">
This text will only be visible to visitors who have a signature
</xf:if>
How to make a withdrawal for users who have no signature in Xenforo?
Code:
<xf:if is="!{$xf.visitor.signature}">
This text will only be visible to visitors who don't have a signature
</xf:if>
User state in Xenforo |
Code:
<xf:if is="{$xf.visitor.user_state} == 'valid'">
This text is only visible to activated users.
</xf:if>
Pending email confirmation:
Code:
<xf:if is="{$xf.visitor.user_state} == 'email_confirm'">
This text is visible only to those who are waiting for confirmation by e-mail.
</xf:if>
Pending email confirmation (after editing):
Code:
<xf:if is="{$xf.visitor.user_state} == 'email_confirm_edit'">
This text is visible only to those who are waiting for confirmation by e-mail (after editing).
</xf:if>
Invalid mail:
Code:
<xf:if is="{$xf.visitor.user_state} == 'email_bounce'">
This text is only visible to those whose email is invalid.
</xf:if>
Pending approval:
Code:
<xf:if is="{$xf.visitor.user_state} == 'moderated'">
This text is only visible to users who are waiting for approval.
</xf:if>
Rejected:
Code:
<xf:if is="{$xf.visitor.user_state} == 'rejected'">
This text is only visible to users who have been rejected.
</xf:if>
Disabled:
Code:
<xf:if is="{$xf.visitor.user_state} == 'disabled'">
This text is only visible to users who have been disabled.
</xf:if>
Conditions:
Code:
<xf:if is="{$xf.visitor.user_state} == 'valid'">
This text is only visible to activated users.
<xf:elseif is="{$xf.visitor.user_state} == 'email_confirm' " />
This text is visible only to those who are waiting for confirmation by e-mail.
<xf:elseif is="{$xf.visitor.user_state} == 'email_confirm_edit' " />
This text is visible only to those who are waiting for confirmation by e-mail (after editing).
<xf:elseif is="{$xf.visitor.user_state} == 'email_bounce' " />
This text is only visible to those whose email is invalid.
<xf:elseif is="{$xf.visitor.user_state} == 'moderated' " />
This text is only visible to users who are waiting for approval.
<xf:elseif is="{$xf.visitor.user_state} == 'rejected' " />
This text is only visible to users who have been rejected.
<xf:elseif is="{$xf.visitor.user_state} == 'disabled' " />
This text is only visible to users who have been disabled.
</xf:if>
If you want to display text in a specific style in Xenforo
Code:
<xf:if is="{$xf.visitor.style_id} == 2">
For style ID 2.
<xf:else />
For other styles.
</xf:if>
If you want to display text in certain styles in Xenforo
Code:
<xf:if is="in_array({$xf.visitor.style_id}, [1, 2])">
For style ID 1 and 2.
<xf:else />
For other styles.
</xf:if>
Display information for language-specific users in Xenforo. |
Code:
<xf:if is="{$xf.language.language_code} == 'ru-RU'">
This text is visible only to users with the Russian language.
</xf:if>
Output for Russian and other languages
Code:
<xf:if is="{$xf.language.language_code} == 'ru-RU'">
This text is visible only to users with the Russian language.
<xf:else />
For other language
</xf:if>
Output for Russian and English, and different text for others
Code:
<xf:if is="in_array({$xf.language.language_code}, ['ru-RU', 'en-US'])">
This text is visible only to users with Russian and English (default) languages.
<xf:else />
For other language
</xf:if>
With conditions
Code:
<xf:if is="{$xf.language.language_code} == 'ru-RU'">
This text is visible only to users with the Russian language.
<xf:elseif is="{$xf.language.language_code} == 'en-US' " />
This text is seen only by users with English.
<xf:else />
For other language
</xf:if>
And another little feature with the language, when exporting a localized language in an .xml file, you can also find the installed code for the language
Code:
<language title="Russian (RU)" date_format="j M Y" time_format="H:i" currency_format="{symbol}{value}" week_start="1" decimal_point="." thousands_separator="," label_separator=":" comma_separator=", " ellipsis="..." parenthesis_open="(" parenthesis_close=")" language_code="ru-RU" text_direction="LTR" export_version="2">
where language_code is defined as a language code, and the value "ru-RU" is the language itself.
And you can get it from the database in the xf_phrase table, language_code column
. There are also some features for the language id:
Code:
1) Passed in the language ID link when choosing a language
2) In the control panel, when hovering over a language, a shorter link showing the language ID will also be transmitted
3) In the Database xf_phrase table, the language_id column
How can I display the number of likes from a particular topic in Xenforo?
Code:
<xf:if is="{$thread.thread_id} == x">
{$thread.first_post_likes|number}
Where x is the theme id
</xf:if>
How can I display content only for those users who have an additional field filled in Xenforo?
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.x}">
This content can only be viewed by those users who have an additional field X filled in (field_id must be replaced with the ID of the desired field)
</xf:if>
Skype extra field:
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.skype}">
This content can only be viewed by users who have the additional skype field filled in
</xf:if>
Additional facebook field:
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.facebook}">
This content can only be viewed by users who have the additional skype field filled in
</xf:if>
Additional twitter field:
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.twitter}">
This content can only be viewed by users who have the additional skype field filled in
</xf:if>
For boys
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.gender} == 'male'">
For boys
</xf:if>
For girls
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.gender} == 'female'">
For girls
</xf:if>
Occupation:
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.occupation}">
For those who indicated the occupation
</xf:if>
Floor conditions:
Code:
<xf:if is="{$xf.visitor.Profile.custom_fields.gender} == 'male'">
For boys
<xf:elseif is="{$xf.visitor.Profile.custom_fields.gender} == 'female'" />
For girls
<xf:else />
For those who did not indicate their gender or another selected gender
</xf:if>
For language ID 1:
Code:
<xf:if is="{$xf.language.language_id} == 1">
For language ID 1
</xf:if>
For language ID 1 and other languages:
Code:
<xf:if is="{$xf.language.language_id} == 1">
For language ID 1
<xf:else />
For other languages
</xf:if>
For language with ID 1, 2:
Code:
<xf:if is="in_array({$xf.language.language_id}, [1, 2]) ">
For language with ID 1 and 2
</xf:if>
For language ID 1, 2 and other languages:
Code:
<xf:if is="in_array({$xf.language.language_id}, [1, 2]) ">
For language with ID 1 and 2
<xf:else />
For other languages
</xf:if>
With conditions:
Code:
<xf:if is="{$xf.language.language_id} == 1">
For language ID 1
<xf:elseif is="{$xf.language.language_id} == 2" />
For language ID 2
<xf:else />
For other languages
</xf:if>
How can I hide text from the forum team in Xenforo?
Code:
<xf:if is="!{$xf.visitor.is_staff}">
This text is visible to everyone except members of the forum team.
</xf:if>
How can I display super admin-only content in Xenforo?
Code:
<xf:if is="{$xf.visitor.is_super_admin}">
This text is only visible to super admins.
</xf:if>
How can I display content in a specific forum in Xenforo?
Code:
<xf:if is="{$forum.node_id} == x">
This text will be shown in forum x
</xf:if>
How can I display content in forum x and y in Xenforo?
Code:
<xf:if is="in_array({$forum.node_id}, [x,y])">
This text will be shown in forum x, y
</xf:if>
How can I display content in a specific category in Xenforo?
Code:
<xf:if is="{$category.node_id} == x">
This text will be shown in category x
</xf:if>
How can I hide content in a specific category in Xenforo?
Code:
<xf:if is="$forum.node_id != 3">
This text will be shown in all categories except 3
</xf:if>
How can I display content in specific categories in Xenforo?
Code:
<xf:if is="in_array({$category.node_id}, [x, y])">
This text will be shown in category x and y
</xf:if>
Correctly insert "your html" after any message on each page (except for personal correspondence)
(Please note that messages are numbered from zero!):
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == 0 AND !{$conversation}">
Your html
</xf:if>
After the second post on each page in Xenforo:
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == 1 AND !{$message.conversation_id}">
Your html after the second message
</xf:if>
Random (random) display in Xenforo:
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == {{ $xf.time % 9 + 1 }} AND !{$message.conversation_id}">
Randomly .. provided that there are 10 messages on the page)))
</xf:if>
How can I display content for users registered less than 30 days in Xenforo?
Code:
<xf:if is="{$xf.visitor.register_date} > {$xf.time} - (3600 * 24 * 30)">
This text will only be visible to users registered for less than 30 days
</xf:if>
How can I display content for users who have been registered for more than 30 days in Xenforo?
Code:
<xf:if is="{$xf.visitor.register_date} < {$xf.time} - (3600 * 24 * 30)">
This text will only be visible to users registered for less than 30 days
</xf:if>
How can I display content in a topic author's post in Xenforo?
Code:
<xf:if is="{$post.user_id} == {$thread.user_id}">
This message will be shown in the theme author's post
</xf:if>
How can I display content after the first post in a topic in Xenforo?
Code:
<xf:if is="{$post.position} == 0">
This text will be displayed after the first message
</xf:if>
How can I display the content after post x on every page of a forum topic or conversation in Xenforo?
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == 1 AND !{$message.conversation_id}">
This text will be shown after post x on every page of the topic
</xf:if>
How can I display content after x posts on each forum topic page in Xenforo?
Code:
<xf:if is="in_array($post.position % $xf.options.messagesPerPage, [2, 4, 6])">
This text will be shown after x, y, z posts on each topic page
</xf:if>
How can I display the content after post x on every forum topic page in Xenforo?
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == x">
This text will be shown after message x on every page
</xf:if>
How can I display content after the first post in a thread or conversation in Xenforo?
Code:
<xf:if is="{$post.position} == 0 AND !{$message.conversation_id}">
This text will be shown after the first post of a topic or conversation
</xf:if>
How can I display content after post x on every page, only in forums y and z in Xenforo?
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == x AND in_array({$thread.node_id}, [y, z])">
This text will be shown after post x on every page, only in forums y and z
</xf:if>
How can I display the content after the x post on every page except for the y and z forums in Xenforo?
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == x AND !in_array({$thread.node_id}, [y, z])">
This text will be shown after post x on every page, only in forums y and z
</xf:if>
How can I display content in a specific forum topic in Xenforo?
Code:
<xf:if is="{$thread.thread_id} == x">
This text will be shown in topic x
</xf:if>
Or like this:
<xf:if is="{$threadId} == x">
This text will be shown in topic x
</xf:if>
How can I display content in a specific post in Xenforo?
Code:
<xf:if is="{$post.post_id} == x">
This text will be shown in the message x
</xf:if>
Or like this
<xf:if is="{$postId} == x">
This text will be shown in post x
</xf:if>
How can I display content in multiple specific posts in Xenforo?
Code:
<xf:if is="in_array({$post.post_id}, [x, y])">
This message will be shown in messages x, y
</xf:if>
Or so
<xf:if is="in_array({$postId}, [x, y])">
This message will be shown in messages x, y
</xf:if>
How can I display content other than a specific message in Xenforo?
Code:
<xf:if is="{$post.post_id} != x">
This text will be shown in the message x
</xf:if>
Or so
<xf:if is="{$postId} != x">
This text will be shown in the message x
</xf:if>
How can I display content other than a few specific messages in Xenforo?
Code:
<xf:if is="!in_array({$post.post_id}, [x, y])">
This message will be shown in messages x, y
</xf:if>
Or so
<xf:if is="!in_array({$postId}, [x, y])">
This message will be shown in messages x, y
</xf:if>
How can I display content across multiple forum topics in Xenforo?
Code:
<xf:if is="in_array({$thread.thread_id}, [x, y])">
This text will only be shown in topics x, y
</xf:if>
Or so
<xf:if is="in_array({$threadId}, [x, y])">
This text will only be shown in topics x, y
</xf:if>
How can I display content other than a specific forum topic in Xenforo?
Code:
<xf:if is="{$thread.thread_id} != x">
This text will be shown in topics other than x
</xf:if>
Or so
<xf:if is="{$threadId} == x">
This text will be shown in topic x
</xf:if>
How can I display content other than a few forum topics?
Code:
<xf:if is="!in_array({$thread.thread_id}, [x, y])">
This text will only be shown in topics x, y
</xf:if>
Or so
<xf:if is="!in_array({$threadId}, [x, y])">
This text will only be shown in topics x, y
</xf:if>
How can I display content only in author x topics in Xenforo?
Code:
<xf:if is="{$thread.user_id} == x">
This message will be visible in topics by author x
</xf:if>
If you want to display the given text in a section on the first page only (forum_view template or where there is a PAGINATION)
Code:
<xf:if is="{$page} == 1">
This text only appears on the first page in a section.
</xf:if>
How can I display content on a specific page in Xenforo?
Code:
<xf:if is="{$template} == 'x'">
This text will be displayed in template x
</xf:if>
How can I display content on specific pages in Xenforo?
Code:
<xf:if is="in_array({$template}, ['forum_list', 'forum_view', 'thread_view'])">
This text will be shown in xyz templates
</xf:if>
How can I display content other than a specific page in Xenforo?
Code:
<xf:if is="{$template} != 'x'">
This text will be shown in patterns other than x
</xf:if>
How can I hide a message in a specific template in Xenforo?
Code:
<xf:if is="$xf.reply.template != 'x'">
won't show up in template x
</xf:if>
or so:
<xf:if is="$__globals.template != 'x'">
won't show up in template x
</xf:if>
or so:
<xf:if is="$template != 'x'">
won't show up in template x
</xf:if>
How can I display content other than certain pages in Xenforo?
Code:
<xf:if is="!in_array({$template}, ['forum_list', 'forum_view', 'thread_view'])">
This text will be shown in templates other than xyz
</xf:if>
How can I only show content when creating a topic in Xenforo?
Code:
<xf:if is="$template == 'forum_post_thread'">
This text will only be shown when the topic is created.
</xf:if>
How can I only hide content when creating a theme in Xenforo?
Code:
<xf:if is="$template != 'forum_post_thread'">
This text will be hidden when the topic is created.
</xf:if>
How can I show the content only when creating a resource in Xenforo?
Code:
<xf:if is="$template == 'xfrm_category_add_resource'">
This text will only be shown when the resource is created.
</xf:if>
How can I only hide content when creating a resource in Xenforo?
Code:
<xf:if is="$template != 'xfrm_category_add_resource'">
This text will be hidden when the resource is created.
</xf:if>
How can I show content only when viewing a search page in Xenforo?
Code:
<xf:if is="$template == 'search_form'">
This text will be shown when viewing the search page
</xf:if>
How can I hide content only when viewing a search page in Xenforo?
Code:
<xf:if is="$template != 'search_form'">
This text will be hidden when viewing the search page
</xf:if>
How can I only show content when viewing "What's New" in Xenforo?
Code:
<xf:if is="$template == 'whats_new'">
This text will be shown when viewing "What's New"
</xf:if>
How can I hide content only when viewing the What's New page in Xenforo?
Code:
<xf:if is="$template != 'whats_new'">
This text will be hidden when viewing "What's New"
</xf:if>
How can I show content only when viewing conversations in Xenforo?
Code:
<xf:if is="$template == 'conversation_view'">
This text will be shown when viewing conversations
</xf:if>
How can I hide content only when viewing conversations in Xenforo?
Code:
<xf:if is="$template != 'conversation_view'">
This text will be hidden when viewing conversations
</xf:if>
How can I show content only when viewing a list of conversations in Xenforo?
Code:
<xf:if is="$template == 'conversation_list'">
This text will be shown when viewing the list of conversations
</xf:if>
How can I hide content only when viewing a list of conversations in Xenforo?
Code:
<xf:if is="$template != 'conversation_list'">
This text will be hidden when viewing the list of conversations
</xf:if>
How can I show content only when galleries are on the main page in Xenforo?
Code:
<xf:if is="$template == 'xfmg_media_index'">
This text will be shown when viewing the gallery on the main page
</xf:if>
How can I hide content only when galleries are on the main page in Xenforo?
Code:
<xf:if is="$template != 'xfmg_media_index'">
This text will be hidden when viewing the gallery on the main page
</xf:if>
How can I show content only when resources are on the main page in Xenforo?
Code:
<xf:if is="$template == 'xfrm_overview'">
This text will be shown when viewing resources on the main page
</xf:if>
How can I hide content only when resources are on the main page in Xenforo?
Code:
<xf:if is="$template != 'xfrm_overview'">
This text will be hidden when viewing resources on the main page
</xf:if>
How can I show content only when viewing a resource in Xenforo?
Code:
<xf:if is="$template == 'xfrm_resource_view'">
This text will be shown when viewing the resource
</xf:if>
How can I hide content only when viewing a resource in Xenforo?
Code:
<xf:if is="$template != 'xfrm_resource_view'">
This text will be hidden when viewing the resource
</xf:if>
How can I show content only when viewing a topic in Xenforo?
Code:
<xf:if is="$template != 'thread_view'">
This text will be hidden when viewing the topic
</xf:if>
How can I show content only when viewing a forum in Xenforo?
Code:
<xf:if is="$template == 'forum_view'">
This text will be shown when viewing the forum
</xf:if>
How can I hide content only when viewing a forum in Xenforo?
Code:
<xf:if is="$template != 'forum_view'">
This text will be hidden when viewing the forum
</xf:if>
How to draw a conclusion for users who have a non-standard rank filled in Xenforo?
Code:
<xf:if is="{$xf.visitor.custom_title}">
This text will only be visible to visitors who have completed a custom title
</xf:if>
How to draw a conclusion for users who do not have a custom rank filled in Xenforo?
Code:
<xf:if is="!{$xf.visitor.custom_title}">
This text will only be visible to visitors who have not completed a custom rank
</xf:if>
How to draw output for users with specific time zone in Xenforo?
Moscow
Code:
<xf:if is="{$xf.visitor.timezone} == 'Europe/Moscow'">
This text will only be visible to visitors whose time zone is Europe/Moscow
</xf:if>
London
Code:
<xf:if is="{$xf.visitor.timezone} == 'Europe/London'">
This text will only be visible to visitors whose time zone is Europe/London
</xf:if>
With conditions
Code:
<xf:if is="{$xf.visitor.timezone} == 'Europe/Moscow'">
This text will only be visible to visitors whose time zone is Europe/Moscow
<xf:elseif is="{$xf.visitor.timezone} == 'Europe/London'">
This text will only be visible to visitors whose time zone is Europe/London
<xf:elseif is="{$xf.visitor.trophy_points} > x" />
This text will only be shown to users who have a different time zone
</xf:if>
How to make a withdrawal for users with a certain amount of warning points in Xenforo?
0 warning points
Code:
<xf:if is="{$xf.visitor.warning_points} == 0">
This text will be shown to users with 0 posts
</xf:if>
Less than x warning points
Code:
<xf:if is="{$xf.visitor.warning_points} < x">
This text will only be shown to users with less than x alert points.
</xf:if>
More than x warning points
Code:
<xf:if is="{$xf.visitor.warning_points} > x">
This text will only be shown to users with more than x alert points. You currently have {$xf.visitor.warning_points} warning points
</xf:if>
With conditions:
Code:
<xf:if is="{$xf.visitor.warning_points} == 0">
This text will be shown to users with 0 posts
<xf:elseif is="{$xf.visitor.warning_points} < x">
This text will only be shown to users with less than x alert points.
<xf:elseif is="{$xf.visitor.warning_points} > x">
This text will only be shown to users with more than x alert points. You currently have {$xf.visitor.warning_points} warning points
</xf:if>
How can I display content to a user on their birthday in Xenforo?
Code:
<xf:if is="{$xf.visitor.Profile.dob_month} == 6 && {$xf.visitor.Profile.dob_day} == 9">
This text will be shown to the user on June 9th.
</xf:if>
How to draw a conclusion for users who have information about themselves in Xenforo?
Code:
<xf:if is="{$xf.visitor.about}">
This text will be visible only to visitors who have filled in information about themselves
</xf:if>
How to draw a conclusion for users who do not have information about themselves in Xenforo?
Code:
<xf:if is="!{$xf.visitor.about}">
This text will be visible only to visitors who do not have information about themselves filled in
</xf:if>
How can I display the current year in Xenforo?
Code:
{{ date($xf.time, 'Y') }}
How can I show content on pages with a sidebar in Xenforo?
Code:
<xf:if is="$sidebar">
This text will be visible on pages with a sidebar
</xf:if>
How can I output an array of names in Xenforo?
Code:
<xf:set var="$names" value="{{ ['Patrick', 'Theresa', 'Kimball', 'Wayne', 'Grace'] }}" />
<xf:foreach loop="$names" key="$key" value="$name" i="$i">
<p>Hello {$name}. Array element number {$i}. Array element key: {$key}</p>
</xf:foreach>
How can I display postbit information for hidden messages in Xenforo?
Code:
<xf:if is="{{ $__globals.post.message_state == 'deleted' }}">
This text will be displayed in postbit for deleted messages
</xf:if>
How can I display postbit information for all visible posts in Xenforo?
Code:
<xf:if is="{{ $__globals.post.message_state == 'visible' }}">
This text will be displayed in postbit for visible posts
</xf:if>
How can I display a message on a specific resource in Xenforo?
Code:
<xf:if is="{{ $resource.resource_id == X }}">
This text will be displayed in resource X
</xf:if>
How can I display a message in certain resources in Xenforo?
Code:
<xf:if is="{{ in_array($resource.resource_id, [X,Y,Z]) }}">
This text will be displayed in resource X, Y, Z
</xf:if>
How to remove the "Complaint" button in the user's personal account against himself in Xenforo?
Create modification - /admin.php?template-modifications/add
Template: member_view
Find:
Code:
<xf:if is="$user.canBeReported()">
<xf:button href="{{ link('members/report', $user) }}"
class="button--link" overlay="true">
{{ phrase('report_verb') }}
</xf:button>
</xf:if>
Replace:
<xf:if is="$xf.visitor != $user">
$0
</xf:if>
Last edited: