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

XF 1.2 Hide Reply Button for First Post in Specific Forum

Discussion in 'XenForo Questions and Support' started by QenTox, Aug 18, 2013.

  1. QenTox

    QenTox Well-Known Member

    This add-on can hide the reply button for first post. Can someone please tell me how to modify this if I want to hide reply button only for certain forum?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Add the node id to the conditional statement.
     
  3. QenTox

    QenTox Well-Known Member

    Thanks, but I am not really good with this, tried that few times, but I always get this error: The following templates contained errors and were not saved: post: 1) Line 51: Template syntax error.

    Could you please post here the exact place, where should I place that .node22 code?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Try:
    Code:
    <xen:if is="{$post.position}!=0 AND {$forum.node_id} == x">
    Replace x with the node ID.
     
  5. QenTox

    QenTox Well-Known Member

    Thanks, no error this time but for some reason still in all forums is the reply button hidden in first post. Tried CTRL + F5, but still no change.
     
  6. QenTox

    QenTox Well-Known Member

    Actually the code you provided hides the reply button for all posts in all forums except the specified node, where reply button is in all posts except the first post.
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Oops, yes.
    G&T + support = not a good idea.

    Just add a new xen:if for the node id, wrapping the original edit.
     
  8. QenTox

    QenTox Well-Known Member

    Like this?

    Code:
    <xen:if is="{$forum.node_id}==22">
      <xen:if is="{$post.position}!=0">
        <xen:if is="{$canReply}">
          <a href="{xen:link threads/reply, $thread, 'quote={$post.post_id}'}" data-postUrl="{xen:link posts/quote, $post}" class="ReplyQuote item control reply" title="{xen:phrase reply_quoting_this_message}"><span></span>{xen:phrase reply}</a>
        </xen:if>
      </xen:if>
    </xen:if>
    It seems like it does the same as the code before.
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    You will also need a xen:else.

    xen:if
    new node 22 code​
    xen:else
    original code​
    /
     
  10. QenTox

    QenTox Well-Known Member

    Code:
    <xen:if is="{$forum.node_id}==22">
    <xen:else />
      <xen:if is="{$post.position}!=0">
        <xen:if is="{$canReply}">
          <a href="{xen:link threads/reply, $thread, 'quote={$post.post_id}'}" data-postUrl="{xen:link posts/quote, $post}" class="ReplyQuote item control reply" title="{xen:phrase reply_quoting_this_message}"><span></span>{xen:phrase reply}</a>
        </xen:if>
      </xen:if>
    </xen:if>
    Not sure if I did it right, but now I have no reply at all in specified forum and in all other forums there is reply button for all posts except the first.
     

Share This Page