One day, user System32 came to me and asked how to do it. That's how it all started...
It looks like this:
Forum1 and Forum2 are not available to guests.
Available for forum versions: ModernBB, AwesomeBB, phpBB3
1. AP - General - Categories and forums - Create new forum\Modify the existing forum
Forum name:
- Code:
<span class='guest_no_access'>FORUM NAME</span>
Save.
2. AP - General - Categories and forums - Modify the existing forum - Permissions - Advanced Mode - In the access rights, leave the check mark only "View the forum":
Save.
3. AP - Modules - Forum widgets management - Display forum widgets - Yes - Save.
4. AP - Modules - Forum widgets management - CREATE A WIDGET
Widget name: any
Use a table type: No
Widget title: any
Widget source:
- For ModernBB:
- Code:
<script>
var name = '{USERNAME}';
if (name === 'Guest') {
$('.guest_no_access').parent().parent().parent().parent().parent().parent().css({'color' : 'black', 'background-color' : '#ADADAD', 'opacity' : '0.5'});
$('.guest_no_access').css("color", "black");
}
</script>
- For AwesomeBB:
- Code:
<script>
var name = '{USERNAME}';
if (name === 'Guest') {
$('.guest_no_access').parent().parent().parent().parent().parent().addClass('guest_no_access_forum');
}
</script> <style>
.guest_no_access_forum {
background-color: red;
opacity: 0.6;
}
.forum-description h3:after, .posts-description h3:after {
box-shadow: none;
}
</style>
- For phpbb3:
- Code:
<script>
var name = '{USERNAME}';
if (name === 'Guest') {
$('.guest_no_access').parent().parent().parent().parent().parent().parent().css({'background-color' : '#ADADAD', 'opacity' : '0.5', 'border-color' : '#ADADAD'});
$('.guest_no_access').css("color", "black");
}
</script>
Save.
Drag and drop the created widget on to the forum layout:
Save.
Attention! I used the {USER NAME} variable in the code. A user who has not logged in to the forum will have guest status by default.
To avoid incorrect operation of the forum, I recommend banning the name "Guest" or equivalent in other languages: AP - General - Usernames censorship.
If you are not using widgets, you can hide them:
- For ModernBB:
- Code:
#content-container #right {
display: none;
}
- For AwesomeBB:
- Code:
#sidebar, #sidebar-left {
display: none;
}
#index {
width: 100%;
}
- For phpbb3:
- Code:
#content-container div#right {
display: none;
}
#content-container div#content {
margin-right:0;
}