XF 2.2 Adding New Posts and Post Thread buttons to Widget Page

Ludachris

Well-known member
I'm using a Page for our forum's homepage, which just displays a bunch of widgets. I want to display the New Posts and Post Thread buttons at the top of the page just like the Forum List page. Would it be best to create a widget for this and display it in the page template? Or just paste the template code for the buttons directly in the page template?
 

Ludachris

Well-known member
I'm looking for the code to include it on my page but I can't find it, do you have it handy? Thank you!
You can use this code, and wrap it with whatever CSS you need:
Code:
<xf:if is="$xf.visitor.canCreateThread() OR $xf.visitor.canCreateThreadPreReg()">
        <xf:button href="{{ link('forums/create-thread') }}" class="button--cta" icon="write" overlay="true" style="margin: 0 5px 8px 0">
           New Thread
        </xf:button>
    </xf:if>

I also added this in the Display condition for my widget so that it displays only to the Registered Members usergroup:
Code:
$xf.visitor.isMemberOf(2)}}
 

Pardal

Active member
You can use this code, and wrap it with whatever CSS you need:
Code:
<xf:if is="$xf.visitor.canCreateThread() OR $xf.visitor.canCreateThreadPreReg()">
        <xf:button href="{{ link('forums/create-thread') }}" class="button--cta" icon="write" overlay="true" style="margin: 0 5px 8px 0">
           New Thread
        </xf:button>
    </xf:if>

I also added this in the Display condition for my widget so that it displays only to the Registered Members usergroup:
Code:
$xf.visitor.isMemberOf(2)}}

Perfect! Thanks!!!
 

PaulProe

Member
This thread outlined exactly what I was looking for - but when I followed the suggestions and inserted the code, I only got one button "New Thread"

I would also like to have the button that lists only the new posts, as appears at the top of the forums page.

Can anyone point me at the correct phrase or section to copy this code and add in to what was given above

Thanks
 
Top