1. 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

Discussion in 'XenForo Questions and Support' started by Deddy, Dec 10, 2013.

  1. Deddy

    Deddy Member

    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?

  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. Deddy

    Deddy Member

    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' ?
  4. Brogan

    Brogan XenForo Moderator Staff Member

  5. Deddy

    Deddy Member


    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?

  6. Brogan

    Brogan 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.
  7. Rudy

    Rudy Well-Known Member

    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.
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Either one works equally as well in that situation.
    Rudy likes this.

Share This Page