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

Create new thread button

Brogan

XenForo moderator
Staff member
#2
The forum_view template contains the HTML but the styling can be done in Style Properties.

HTML:
<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>
 

Lee

Well-known member
#4
Sweet, thanks.

I'm using it to replace the thread creation button with that of a custom form in a certain section.

Works a charm.
 
#5
Sweet, thanks.

I'm using it to replace the thread creation button with that of a custom form in a certain section.

Works a charm.
@Lee just what I'm looking for here.
Idea is to exchange the Post New Thread Button with a different button (that links anywhere) in a certain forum.
Would very much appreciate your code editings!
 
Last edited:

0ptima

Well-known member
#7
@Lee just what I'm looking for here.
Idea is to exchange the Post New Thread Button with a different button (that links anywhere) in a certain forum.
Would very much appreciate your code editings!
In the forum_view template find
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>
replace it with

Code:
<xen:if is="{$canPostThread}">
<xen:if is="in_array({$forum.node_id}, array(X, Y, Z))">
    <xen:set var="$newDiscussionButton"><a href="http://newlink.com" class="callToAction"><span>New Link</span></a></xen:set>
<xen:else />
    <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>
X, Y,Z are node IDs, which you need to adapt to your forum
 
#8
@Optima
Thanks, just what I needed. ;)
Note: One </xen:if> is missing in your code.

Now, there is still this 'Post New Thread' Button on the bottom, where can I find the equivalent code?
Thanks, best regards!