Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: ScousePete on October 14, 2006, 05:34:28 PM

Title: Hide news from guests
Post by: ScousePete on October 14, 2006, 05:34:28 PM
SMF Version: SMF 1.1 RC3
I would like to hide the news box from guests in the log-in screen.

I know that I need to add:
if ($context['user']['is_logged'])

to somewhere before:
// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<div class="headertitles" style="width: 260px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
<div class="headerbodies" style="width: 260px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif); margin-bottom: 8px;">
<img src="', $settings['images_url'], '/', $context['user']['language'], '/newsbox.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
<div style="height: 50px; overflow: auto; padding: 5px;" class="smalltext">', $context['random_news_line'], '</div>
</div>';


on index.template.php, but I am not sure of the correct syntax.

Can someone help?
Title: Re: Hide news from guests
Post by: winrules on October 14, 2006, 05:37:56 PM
Find:
if (!empty($settings['enable_news']))
Replace With:
if (!empty($settings['enable_news']) && $context['user']['is_logged'])

Basically you just need to add it on to the if statement seeing if th enews is enabled.
Title: Re: Hide news from guests
Post by: ScousePete on October 14, 2006, 05:54:18 PM
Excellent (and fast!) - thank you so much!
Title: Re: Hide news from guests
Post by: joejackson on April 20, 2007, 08:59:35 AM
Doesn't work for me.
Newsbox remains visible to all

Joomla 1.0.12
SMF 1.1.2
SMF bridge 1.1.7
Title: Re: Hide news from guests
Post by: KitKat2 on December 09, 2024, 09:06:02 AM
Is there a more current way to hide the scrolling news from guests and unregistered users?  I have a few themes on my forum and one of them doesn't show the scrolling news to guests, but the others do so I'm thinking there's a setting I'm missing that I can just turn on or off instead of having to fiddle with the code.
Title: Re: Hide news from guests
Post by: Aleksi "Lex" Kilpinen on December 09, 2024, 10:29:05 AM
No, news has no permissions to it. If a specific theme works differently from the rest, it's the theme.

Edit:
Most every theme does have it's own setting for the news and it's layout though, it's "Enable random news line in the forum header " and "Show news fader on board index". See Admin -> Configuration -> Themes and Layout -> Theme settings
This has been the case pretty much always.
Title: Re: Hide news from guests
Post by: KitKat2 on December 09, 2024, 10:32:58 AM
ok, thank you!

p.s.  just used the instructions above from 2006 and the code replacement still works today, almost 2025, on v 2.0.x (yeah, i know.  I need to update, but my main theme doesn't work on v. 2.1.x)