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?
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.
Excellent (and fast!) - thank you so much!
Doesn't work for me.
Newsbox remains visible to all
Joomla 1.0.12
SMF 1.1.2
SMF bridge 1.1.7
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.
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.
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)