XF 2.3 Post new thread button

Hi all,

I have a question.
I want a extra "post thread" button below a post.

I have made a picture of what i mean/want.

example.webp


Is there a piece of code or add-on that does this?

Regards
Bob
 
Solution
Tested in PAGE_CONTAINER and will only show the Post thread... button if they have permission to post in that node while viewing the threads.
HTML:
<xf:if is="$template == 'thread_view'">
    <xf:if is="$forum.canCreateThread() OR $forum.canCreateThreadPreReg()">
            <xf:button href="{{ link('forums/post-thread', $forum) }}" class="button--cta" icon="write" rel="nofollow">
            {{ $forum.TypeHandler.getTypeActionPhrase('cta') ?: phrase('post_thread') }}</xf:button>
    </xf:if>
</xf:if>
There are two methods that can be used.

If you want to post in the same forum as that thread shown or if you want to post in any node.

In any node, this placement anywhere should be fine:
HTML:
    <xf:if is="$xf.visitor.canCreateThread() OR $xf.visitor.canCreateThreadPreReg()">
        <xf:button href="{{ link('forums/create-thread') }}" class="button--cta" icon="write" overlay="true" rel="nofollow">
            {{ phrase('post_thread...') }}
        </xf:button>
    </xf:if>

It'll create an overlay of where the user wants to post a thread to.

It might be a little trickier to make a post thread button to post in the same node, but most likely doable. Just wondering if that's the action you'd prefer before I attempt to modify it.

Placement would be on you to determine positioning, etc., as I don't have that style to attempt the placement you want.
 
Tested at the bottom of PAGE_CONTAINER
HTML:
<xf:if is="$template == 'thread_view'">
        <xf:button href="{{ link('forums/post-thread', $forum) }}" class="button--cta" icon="write" rel="nofollow">
        {{ $forum.TypeHandler.getTypeActionPhrase('cta') ?: phrase('post_thread') }}
    </xf:button>
</xf:if>

It will only show the button on viewing a thread and take you to a page to post a thread in the node the currently viewed thread is.

I used the <xf:if> statement as it may appear to be a placement in your PAGE_CONTAINER being near the bottom, but you likely only want to show it when someone is viewing a thread.
 
Tested in PAGE_CONTAINER and will only show the Post thread... button if they have permission to post in that node while viewing the threads.
HTML:
<xf:if is="$template == 'thread_view'">
    <xf:if is="$forum.canCreateThread() OR $forum.canCreateThreadPreReg()">
            <xf:button href="{{ link('forums/post-thread', $forum) }}" class="button--cta" icon="write" rel="nofollow">
            {{ $forum.TypeHandler.getTypeActionPhrase('cta') ?: phrase('post_thread') }}</xf:button>
    </xf:if>
</xf:if>
 
Last edited:
Solution
Back
Top Bottom