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

Black Tiger

Active 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;
    }
   
}

Black Tiger

Active member
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?
 

Black Tiger

Active member
Thank you. I didn't change anything before. Only the whats-new was empty, but the new posts had the line I stated.

If I do it like you stated, it says "Display condition: Line 1: syntax error.
 

Black Tiger

Active member
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:

apathy

Active member
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
 

nicodak

Well-known member
YOU {$xf.options.forumsDefaultPage} != 'new_posts' && !$xf.visitor.user_id
or
ME {$xf.options.forumsDefaultPage} != 'new_posts' and $xf.visitor.user_id
it's same code i think :)
 

apathy

Active member
YOU {$xf.options.forumsDefaultPage} != 'new_posts' && !$xf.visitor.user_id
or
ME {$xf.options.forumsDefaultPage} != 'new_posts' and $xf.visitor.user_id
it's same code i think :)
I think OP wants to hide it for guests, so $xf.visitor.user_id needs a !
EDIT: or does using "and" continue the != part? I've only used && so I wouldnt know
 

Black Tiger

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

nicodak

Well-known member
But it's strange because {$xf.options.forumsDefaultPage} != 'new_posts' and $xf.visitor.user_id in my case works fine.
with this condition the New Posts links is not displayed... :unsure:
 
Top