Create new thread button

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>
 
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.
 
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:
@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
 
  • Like
Reactions: it_
@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!
 
Top Bottom