XF 2.2 How can I remove new posts and whats-new for guests?

Black Tiger

Well-known member
How do I remove the "new posts" button and whats-new for guests? I would like them to register and login to have these options.
I know I can take them away in the Public Navigation, but I do want them present for my users.
 
Solution
If you would rather use CSS, you can add this to the extra.less template to hide it:

Less:
[data-template="forum_list"][data-logged-in="false"]
{
    .p-title-pageAction .button--icon--bolt
    {
        display: none;
    }
   
}
Thank you, but how do I add this, with a pipe it does not work.

The new posts display condition already contains this by default:
{$xf.options.forumsDefaultPage} != 'new_posts'

Do I just pot your statement behind it with a space, or komma with space or something else?
 
Thank you. That line is accepted, but unfortunately has no effect. It does not remove the new posts button from guests.
Odd... it worked for the whats-new section though.

I also tried to put it in both new posts sections, the one which I do under forums and also the one under the whats-new, but that also had no effect.
 
Last edited:
This is what I'm using to hide a widget if A) a user hasnt disabled it with a custom field B) a user is not a guest

Code:
!$xf.visitor.Profile.custom_fields.online_today_disable && $xf.visitor.user_id

In your case I think it should be:

Code:
{$xf.options.forumsDefaultPage} != 'new_posts' && !$xf.visitor.user_id
 
Remove what you have there now and put in what I show in the image.
Sorry, but if absolutely necessary, I rather don't remove original things. If possible ofcouse.

I think OP wants to hide it for guests, so $xf.visitor.user_id needs a !
If possible even disable it for guests so they can't visit it when they would know the hidden link.

I tried this now, but it does not hide the new posts button.
{$xf.options.forumsDefaultPage} != 'new_posts' && !$xf.visitor.user_id
also tried without the ! but same result.
 
Back
Top Bottom