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

XF 1.5 Text before and after first post in the thread.

Discussion in 'XenForo Questions and Support' started by DaveRite, Jan 30, 2016.

  1. DaveRite

    DaveRite Member

    I'm trying to edit the ad_message_body to make certain text appear in the beginning and at the end of the post. I am only able to get a line of text to appear in the beginning.

    I'm trying to get the text in the message body itself, not after or before it.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    The ad_message_body template is for in the post, the ad_message_below template is for after the post.
     
    DaveRite likes this.
  3. DaveRite

    DaveRite Member

    I want the text displayed in the message body itself. Example: https://i.imgur.com/gHXvVQv.png
     
  4. DaveRite

    DaveRite Member

  5. DaveRite

    DaveRite Member

    So is this impossible then @Brogan
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    The easiest way is probably just to edit the message template.

    upload_2016-1-31_14-15-13.png
     
    DaveRite likes this.
  7. DaveRite

    DaveRite Member

    This is very helpful @Brogan I really appreciate you replying. I would also like to know if it's possible to make that text only specific to 1 section (1 node) and just make the text show up for the thread post and not the comments.

    Thanks again
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Yes, you can use a conditional statement utilising the node id, the thread first post id and the message post id.
    Code:
    <xen:if is="{$forum.node_id} == 1 AND {$thread.first_post_id} == {$message.post_id}">
        Content
    </xen:if>
    Change the 1 to the actual node ID.
     
    DaveRite likes this.
  9. DaveRite

    DaveRite Member

    Here's how my code is set up


    PHP:
    <article>
                    <
    blockquote class="messageText SelectQuoteContainer ugc baseHtml{xen:if $message.isIgnored, ' ignored'}">
                        <
    xen:include template="ad_message_body" />
                   
                        <
    xen:if is="{$forum.node_id} == 8 AND {$thread.first_post_id} == {$message.post_id}">
                        [
    code]</xen:if>
                        {
    xen:raw $message.messageHtml}
                        <
    xen:if is="{$forum.node_id} == 8 AND {$thread.first_post_id} == {$message.post_id}">
                        [/
    code]</xen:if>

                        <
    div class="messageTextEndMarker">&nbsp;</div>
                    </
    blockquote>
                </
    article>
    But when I put this in and make a thread, the code tags don't work on the forum.
    [​IMG]

    Any way to fix this? Thanks in advance @Brogan you've been very helpful, I really appreciate it.

    Btw, the comment in the thread was just to show the code tags are actually working
     
  10. Brogan

    Brogan XenForo Moderator Staff Member

    Why are you trying to wrap the message content in code tags?

    Your initial request sounded like you just wanted to add some text either side of the post content but now it seems like you are trying to do something specific.
     
  11. DaveRite

    DaveRite Member

    I needed a certain section to force users to have to reply to the post before viewing it. It's a 3rd party plugin but the code tags have the same exact concept and it's preloaded with Xenforo. I know you guys don't support 3rd party related issues so I showed the example with the code tags.

    I know my request was just adding text, I thought that it would automatically work with the code tags, and it didn't.

    So now I'm just wondering if there's a way for those code tags to automatically work on the thread post.

    And sorry for this stupid request, if there's any way you can help me fix this issue it would be greatly appreciated @Brogan
     
  12. Brogan

    Brogan XenForo Moderator Staff Member

    You would be better off asking the developer of the add-on to add some additional functionality, or advise how it can be achieved with a code edit.
     
  13. DaveRite

    DaveRite Member

    Can we just pretend that I'm just using the [.code][./code] tags? I don't think the developer is active
     

Share This Page