• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Conditional Statement for Xenforo section

Dear All,

I have an ad-banner that I place below the header. However, I want to disable the banner
when the user is "registering", or in their profile page... or in private conversation.

How can I use the XenForo conditional statement to do that?

Hi Brogan, thanks for the reply.

This is what I did for the conditions and it's working. Cheers mate.

<xen:if is="!in_array({$contentTemplate}, array('register_form','account_personal_details', 'member_view', 'conversation_add', 'conversation_view')) ">

What template is 'cta_overtaking_index' ?

I wonder if there's a polling add-on to control creation of polling to a certain usergroup?

If not I can perhaps create a usergroup "Enable Poll Creator Usergroup" and then I could write a conditional section to display or not to display the polling
creation section of new threads?



XenForo moderator
Staff member
There is no permission related to the creation of polls.

You could edit the template(s) to hide the relevant content from certain user groups.


Well-known member
Ads can be restricted from conversations using {$message.conversation_id}.
I created a "Thread Starter" banner for posts, which stacks underneath the "Staff Member" banner (and others). And it is showing up on all participants in a private conversation. (We can't all be thread starters there. ;) )

Obviously wrapping it in another conditional would fix that behavior. So, would a conditional then need to check for the existence of a conversation ID, using this code?

<xen:if is="!{$message.conversation_id}">
Or, I found a simpler example in another of your tutorials:

<xen:if is="!{$conversation}">
My question: is either OK, or is one better to use than the other?

I ended up going with this, and it works (so far as I can tell--thread starter banner showing on threads, but not private conversations):

<xen:if is="{$post.user_id} == {$thread.user_id} AND !{$conversation}">
Just wondering if there are any unintended side-effects.