Topic: [Solved] No announcement for logged users
Hi all!
I use "announcement" to display ads but I would to find something to hide it for logged users.
Is there a way to hide "announcement" for those?
Thanks!
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.3 troubleshooting → [Solved] No announcement for logged users
Hi all!
I use "announcement" to display ads but I would to find something to hide it for logged users.
Is there a way to hide "announcement" for those?
Thanks!
Probably would be an attractive feature as it's a good incentive to register...
Replacing
header.php, line 176
$gen_elements['<!-- forum_announcement -->'] = ($forum_config['o_announcement'] == '1' && $forum_user['g_read_board'] == '1') ? '<div id="brd-announcement" class="gen-content">'.($forum_config['o_announcement_heading'] != '' ? "\n\t".'<h1 class="hn"><span>'.$forum_config['o_announcement_heading'].'</span></h1>' : '')."\n\t".'<div class="content">'.$forum_config['o_announcement_message'].'</div>'."\n".'</div>'."\n" : '';
With
$gen_elements['<!-- forum_announcement -->'] = ($forum_config['o_announcement'] == '1' && $forum_user['g_read_board'] == '1' && $forum_user['username'] == 'Anonymous') ? '<div id="brd-announcement" class="gen-content">'.($forum_config['o_announcement_heading'] != '' ? "\n\t".'<h1 class="hn"><span>'.$forum_config['o_announcement_heading'].'</span></h1>' : '')."\n\t".'<div class="content">'.$forum_config['o_announcement_message'].'</div>'."\n".'</div>'."\n" : '';
Should work
It doesn't work, there's no announcement anymore with that code.
That's weird... worked fine on localhost
I tried again, it really doesn't work...
FYI, for this code to work in 1.3, you need to do the following on Line 176 of header.php:
$gen_elements['<!-- forum_announcement -->'] = ($forum_config['o_announcement'] == '1' && $forum_user['g_read_board'] == '1' && $forum_user['username'] == 'Guest') ? '<div id="brd-announcement" class="gen-content">'.($forum_config['o_announcement_heading'] != '' ? "\n\t".'<h1 class="hn"><span>'.$forum_config['o_announcement_heading'].'</span></h1>' : '')."\n\t".'<div class="content">'.$forum_config['o_announcement_message'].'</div>'."\n".'</div>'."\n" : '';
@Huuuze: Ah, haven't thought about another possible Guest aliases...
So, this code, should work for everyone (no matter how is his "guest" called)
[code=php]$gen_elements['<!-- forum_announcement -->'] = ($forum_config['o_announcement'] == '1' && $forum_user['g_read_board'] == '1' && $forum_user['group_id'] == 2) ? '<div id="brd-announcement" class="gen-content">'.($forum_config['o_announcement_heading'] != '' ? "\n\t".'<h1 class="hn"><span>'.$forum_config['o_announcement_heading'].'</span></h1>' : '')."\n\t".'<div class="content">'.$forum_config['o_announcement_message'].'</div>'."\n".'</div>'."\n" : '';[/code]
Thanks, now it works !
PunBB Forums → PunBB 1.3 troubleshooting → [Solved] No announcement for logged users
Powered by PunBB, supported by Informer Technologies, Inc.