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

XF 1.3 Move Post New Thread Button

Mouth

Well-known member
#1
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.png
 

Brogan

XenForo moderator
Staff member
#2
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>
 

Mouth

Well-known member
#3
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?
 

Mouth

Well-known member
#5
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?
 

Russ

Well-known member
#7
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.png

Button will only show if they have access to a button there(like default)
 

ge66

Active member
#10
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.
 

rwm1962

Active member
#11
Can anyone tell me please how to move the button to the left & below the node desription (& just to the left on nodes with sub-forums)?
 
#12
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 :)