XF 1.3 Move Post New Thread Button

Mouth

Well-known member
Users find it un-intuitive to find the Post New Thread button at the top, due to it being inconsistent with the bottom location and away from the forum content. Thus I would like to move it, as shown in below screenshot, so that it resolves both these issues. In which template(s) would I have to adjust to move the button? Thanks.

Untitled.webp
 
The template is forum_view.

The relevant code is:
Code:
<xen:if is="{$canPostThread}">
    <xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a></xen:set>
    <xen:if is="!{$renderedNodes}">
        <xen:topctrl>{xen:raw $newDiscussionButton}</xen:topctrl>
    </xen:if>
</xen:if>
 
Thanks Brogan.

To move/replicate it to my desired location, it appears it has to go into the page_container template, just above
Code:
<xen:hook name="page_container_content_title_bar">
with something like
Code:
<div style="float:right">
Insert Post New Thread button code here
</div>

But then it will appear on all pages. Is there a 'xen:if is=' statement that I could use to wrap around it determine that I'm at a forum_view page only?
 
Thanks again Brogan. I now have
<xen:if is="{$contentTemplate} == 'forum_view'">
<div id="page_container_content_top_post_new_thread" style="float:right">
<xen:if is="{$canPostThread}">
<xen:set var="$newDiscussionButton"><a href="{xen:link 'forums/create-thread', $forum}" class="callToAction"><span>{xen:phrase post_new_thread}</span></a></xen:set>
<xen:elseif is="{$visitor.user_id}" />
<span class="element">({xen:phrase no_permission_to_post})</span>
<xen:else />
<label for="LoginControl"><a href="{xen:link login}" class="concealed element">({xen:phrase log_in_or_sign_up_to_post})</a></label>
</xen:if>
</div>
</xen:if>

and it's only appearing on the forum_view page, but instead of producing the button it's instead giving the elseif and showing phrase no_permission_to_post. I assume that {$canPostThread} is not available within page_container? Is there something else I can (should be) using instead within page_container?
 
Unless I'm missing the obvious... why not just move that button a single time. We have this as an option in our framework:

Page_container

Find:

<xen:if is="{$topctrl}"><div class="topCtrl">{xen:raw $topctrl}</div></xen:if>

Remove from the breadcrumb, we placed ours right of the title:

so place that snippit above:

</h1>
<xen:if is="{$pageDescription.content}">

Result:

Jwgx9PQ.webp

Button will only show if they have access to a button there(like default)
 
Unless I'm missing the obvious... why not just move that button a single time. We have this as an option in our framework:

Page_container

Find:

<xen:if is="{$topctrl}"><div class="topCtrl">{xen:raw $topctrl}</div></xen:if>

Remove from the breadcrumb, we placed ours right of the title:

so place that snippit above:

</h1>
<xen:if is="{$pageDescription.content}">

Result:

View attachment 70304

Button will only show if they have access to a button there(like default)
Thank you for this!
Could you please help with how one should do it if the forum has subforums, I think I want the button in the same place and not below the subforums as it is now.
 
Unless I'm missing the obvious... why not just move that button a single time. We have this as an option in our framework:

Page_container

Find:

<xen:if is="{$topctrl}"><div class="topCtrl">{xen:raw $topctrl}</div></xen:if>

Remove from the breadcrumb, we placed ours right of the title:

so place that snippit above:

</h1>
<xen:if is="{$pageDescription.content}">

Result:

View attachment 70304

Button will only show if they have access to a button there(like default)
This helped me a lot. Thank you @Russ :)
 
Top Bottom