Resource icon

Add 'Post Reply' & 'Post Thread' buttons to the top of thread view pages

Nebulous

Well-known member
Nebulous submitted a new resource:

Add 'Post Reply' & 'Post Thread' buttons to the top of thread view pages - Add 'Post Reply' & 'Post Thread' buttons to the top of thread view pages

This is just a simple template edit that will give your forum 'Post Reply' and 'Post Thread' buttons at the top of thread view pages.
  • Post Reply button will open an overlay where users can reply directly to the thread they're currently viewing.
  • Post Thread button will open an overlay where users can select a forum before creating a new thread.
Go to:
ACP --> Template --> thread_view and find:

Code:
<xf:breadcrumb source="$forum.getBreadcrumbs()" />
...

Read more about this resource...
 
Excellent.... Now how do you add the Post Thread at the bottom of the thread?

EDIT: It would be nice if it functioned the same way as it does in the Nodes list... meaning... it should ask you to create a new thread for the node that you're currently in vs selecting one from the list... Is there a way to change that?

2ND EDIT: I asked chatgpt to modify your code and it did a good job. The results...

Certainly, if you want to modify the template code to make the "Post Thread" button function similarly to how it works in the Nodes list, you'll need to adapt the template code accordingly. In the example you provided, the code checks if the visitor can create a thread in the current forum and displays the "Post Thread" button.
Here's a modified version of the code that aims to create a "Post Thread" button for the current forum (similar to the Nodes list behavior):


Code:
<xf:pageaction>
    <xf:if is="$xf.visitor.canCreateThread()">
        <xf:button href="{{ link('forums/create-thread', $forum) }}" class="button--primary" icon="write" overlay="true" rel="nofollow">
            {{ phrase('post_thread') }}
        </xf:button>
    </xf:if>
</xf:pageaction>

This code checks if the visitor can create a thread in the current forum ($forum) and displays the "Post Thread" button with a link directly to the "Create Thread" page for that forum.
Please replace the existing code with this modified version in your template (thread_view). If you encounter any issues or have additional questions, feel free to ask for further assistance.
 
Last edited:
Back
Top Bottom