XF 2.2 Hide postbit on specific board using modified default style?

KensonPlays

Well-known member
I looked at the following thread, https://xenforo.com/community/threads/remove-postbit-for-first-post-in-a-certain-forum.111923/

But I could not see a "message_user_info" template or phrase for default style? Also, that thread is from 1.5. Not sure what's changed in 2.2.

I'd like to hide the user postbit for my "site pages" board which I use for creating custom pages without needing to understand HTML, especially since I want to have some fancy-ish layouts like floating text, accordions, etc, from Xon's bbcode addon.

I do not understand enough code to do layouts like that I can barely do headers, text alignment (like centering headers), and links. lol

Edit:
I want to hide the following sections, highlighted and arrowed in red. I know turning off replies hides the box for regular users so that's not a problem.
1688596871931.webp
 
Last edited:
Solution
You have to edit:

1. post_macros - wrap the if-condition around this block:

HTML:
                   <div class="message-cell message-cell--user">
                        <xf:macro template="message_macros" name="user_info" arg-user="{$post.User}"
                            arg-fallbackName="{$post.username}"
                            arg-includeMicrodata="{$includeMicrodata}"
                            arg-itemProp="author" />
                    </div>

2. thread_view - wrap the if-condition around these 2 blocks:

HTML:
    <ul class="listInline listInline--bullet">
        <li>
            <xf:fa icon="fa-user" title="{{ phrase('thread_starter')|for_attr }}" />
            <span class="u-srOnly">{{...
Does article type work for you? The author pane is at the bottom instead of on the left, more like a traditional article, and it's the format XF uses for their own official threads. Example: https://xenforo.com/community/threads/xenforo-2-2-13-released.214344/
That's what I plan to use but I still want to hide the user info at the bottom for just that one board for the pages, so it looks more like a page than another thread.

I found that thread but it was for 1.5 and it seems templates or something was changed in the meantime.

I'm still on 2.2.12, I can't afford to upgrade to 2.2.13 until I find a stable income from a job (unemployed since Dec). Thankfully a friend's hosting my site for free.


Edit: Tweaked OP to highlight the areas I want to hide.

Edit 2: found this, but its not maintained. RIP: https://xenforo.com/community/resources/xd-hide-user-cell-on-first-post.6811/
 
Last edited:
You should be able to do this with template edits: Just wrap the parts that you want to remove around <xf:if is="!$forum.node_id == 123">...</xf:if> (replace 123 with the appropriate node id!).

Example:

HTML:
<xf:if is="!$forum.node_id == 123">
               // The content, that you wan to remove on forum with node id 123..
</xf:if>

This resource is always helpful for conditional statements in XF template : https://xenforo.com/community/resources/conditional-statements-for-xenforo-2.5795/
 
You should be able to do this with template edits: Just wrap the parts that you want to remove around <xf:if is="!$forum.node_id == 123">...</xf:if> (replace 123 with the appropriate node id!).

Example:

HTML:
<xf:if is="!$forum.node_id == 123">
               // The content, that you wan to remove on forum with node id 123..
</xf:if>

This resource is always helpful for conditional statements in XF template : https://xenforo.com/community/resources/conditional-statements-for-xenforo-2.5795/
Yea, but I don't know which ones are the highlighted sections in OP. At the very least, hide postbit, but I'd also like to hide the highlighted bits too if possible. (if not, that's fine)

That guide also doesn't seem to state which template to edit, nor what text to put in it, unless its simply something like:
HTML:
<xf:if is="!$forum.node_id == 123">
               $message
</xf:if>

I'm honestly not sure what the full code/syntax is at all. I'm not a coder in the slightest except <p> and <h1/2/3> lol
 
Last edited:
You have to edit:

1. post_macros - wrap the if-condition around this block:

HTML:
                   <div class="message-cell message-cell--user">
                        <xf:macro template="message_macros" name="user_info" arg-user="{$post.User}"
                            arg-fallbackName="{$post.username}"
                            arg-includeMicrodata="{$includeMicrodata}"
                            arg-itemProp="author" />
                    </div>

2. thread_view - wrap the if-condition around these 2 blocks:

HTML:
    <ul class="listInline listInline--bullet">
        <li>
            <xf:fa icon="fa-user" title="{{ phrase('thread_starter')|for_attr }}" />
            <span class="u-srOnly">{{ phrase('thread_starter') }}</span>

            <xf:username user="{$thread.User}" defaultname="{$thread.username}" class="u-concealed" />
        </li>
        <li>
            <xf:fa icon="fa-clock" title="{{ phrase('start_date')|for_attr }}" />
            <span class="u-srOnly">{{ phrase('start_date') }}</span>

            <a href="{{ link('threads', $thread) }}" class="u-concealed"><xf:date time="{$thread.post_date}" /></a>
        </li>
        <xf:if is="$xf.options.enableTagging AND ($thread.canEditTags() OR $thread.tags)">
            <li>
                <xf:macro template="tag_macros" name="list"
                    arg-tags="{$thread.tags}"
                    arg-tagList="tagList--thread-{$thread.thread_id}"
                    arg-editLink="{{ $thread.canEditTags() ? link('threads/tags', $thread) : '' }}" />
            </li>
        </xf:if>
    </ul>

HTML:
                    <xf:if is="!$thread.discussion_open">
                        <dd class="blockStatus-message blockStatus-message--locked">
                            {{ phrase('not_open_for_further_replies') }}
                        </dd>
                    </xf:if>

I thinks that should do the trick. :-)
 
Solution
Hmm... I have them like this. Still shows. I tried both category number (29), and node number (42) both.

Code:
<xf:if is="!$forum.node_id == 29">
     <div class="message-cell message-cell--user">
          <xf:macro template="message_macros" name="user_info" arg-user="{$post.User}"
               arg-fallbackName="{$post.username}"
               arg-includeMicrodata="{$includeMicrodata}"
               arg-itemProp="author" />
     </div>
</xf:if>

Code:
<xf:description meta="false">
    <xf:if is="!$forum.node_id == 29">
    <ul class="listInline listInline--bullet">
        <li>
            <xf:fa icon="fa-user" title="{{ phrase('thread_starter')|for_attr }}" />
            <span class="u-srOnly">{{ phrase('thread_starter') }}</span>

            <xf:username user="{$thread.User}" defaultname="{$thread.username}" class="u-concealed" />
        </li>
        <li>
            <xf:fa icon="fa-clock" title="{{ phrase('start_date')|for_attr }}" />
            <span class="u-srOnly">{{ phrase('start_date') }}</span>

            <a href="{{ link('threads', $thread) }}" class="u-concealed"><xf:date time="{$thread.post_date}" /></a>
        </li>
        <xf:if is="$xf.options.enableTagging AND ($thread.canEditTags() OR $thread.tags)">
            <li>
                <xf:macro template="tag_macros" name="list"
                    arg-tags="{$thread.tags}"
                    arg-tagList="tagList--thread-{$thread.thread_id}"
                    arg-editLink="{{ $thread.canEditTags() ? link('threads/tags', $thread) : '' }}" />
            </li>
        </xf:if>
    </ul>
    </xf:if>
</xf:description>

Code:
                    <xf:if is="!$forum.node_id == 29">
                    <xf:if is="!$thread.discussion_open">
                        <dd class="blockStatus-message blockStatus-message--locked">
                            {{ phrase('not_open_for_further_replies') }}
                        </dd>
                    </xf:if>
                    </xf:if>

I tested by going in Incognito and they still show the various postbits.
 
You mean this section, right?


Did you double check the node_id? It must be the ID of the "announcements" node. Did you also double check, that you edited the right style?
 
Hmm, changed to that in all 3 places. Then I did a "Ctrl + R" and no change (in normal), as well as incognito.
again, my fault.. :eek:

for post_macros please try: <xf:if is="$thread.Forum.node_id != 42"> ($thread should be available in this template, $forum not).

the other template edit should work, I think..

P.S. or maybe better just <xf:if is="$thread.node_id != 42">
 
again, my fault.. :eek:

for post_macros please try: <xf:if is="$thread.Forum.node_id != 42"> ($thread should be available in this template, $forum not).

the other template edit should work, I think..

P.S. or maybe better just <xf:if is="$thread.node_id != 42">
Hmm, I tried both the first and second one you shared there in post_macros but nothing. Incognito even.

And yea, I'm doing it in the right theme, "Main" on my site.
 
Hmm, I tried both the first and second one you shared there in post_macros but nothing. Incognito even.

And yea, I'm doing it in the right theme, "Main" on my site.
o.k. you have to change the thread types to "Discussion" (instead of "Article") to make my changes work. Shouldn't make a difference with my edits. ;)
 
o.k. you have to change the thread types to "Discussion" (instead of "Article") to make my changes work. Shouldn't make a difference with my edits. ;)
This is very weird.

I went into the node and did a "change type" to discussion. Current "Article" threads still display the postbit, but so does a "test" page I created with a copy of another pages text. Both are showing the postbit.

Brand new created test 'page'
 
I have tested it and it does work: The user info block on the left is gone with my edit of post_macros. I would need an admin account to look into this.
 
Thank you for the credentials.

I fixed post_macros: You added code at the end instead of editing the right code above.

I also fixed the "not open for further replies" still showing up (it is inside a macro, where we don't have access to $forum).
 
Top Bottom