The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How do I make it so only a guest can see a certain forum?

3 posters

Go down

Solved How do I make it so only a guest can see a certain forum?

Post by TheSmallestOpp October 12th 2023, 5:50 pm

So not long ago I created my forum and I basically want it to be private to where someone that isn't logged in or isn't a member and is a guest can't see any of the categories and forums. I made a category that says "If you see this your a guest!" and then the forum attached to it says to register an account to view the contents of the forum and so on. The problem is that it wont let me make it so only guests can see because what members can't do guest can't because the role is higher. And I don't want members to have to always see it because it would be annoying for them and such. How do I work around this?


Last edited by TheSmallestOpp on October 13th 2023, 6:54 pm; edited 1 time in total
TheSmallestOpp
TheSmallestOpp
New Member

Male Posts : 3
Reputation : 1
Language : English

Back to top Go down

Solved Re: How do I make it so only a guest can see a certain forum?

Post by skouliki October 12th 2023, 6:54 pm

what if you gather all the members in a group
called "forum members"
Minimum Posts : 1

and then go to that category settings and uncheck the possibility to read view and post

skouliki
skouliki
Manager
Manager

Female Posts : 15391
Reputation : 1709
Language : English,Greek
Location : Greece

http://iconskouliki.forumgreek.com

Back to top Go down

Solved Re: How do I make it so only a guest can see a certain forum?

Post by TheSmallestOpp October 12th 2023, 10:47 pm

skouliki wrote:what if you gather all the members in a group
called "forum members"
Minimum Posts : 1

and then go to that category settings and uncheck the possibility to read view and post

If I do that then anyone who's a member would need to have at least 1 post which some would probably just want to lurk and not have to post anything, is there an alternative to having to have 1 post?
TheSmallestOpp
TheSmallestOpp
New Member

Male Posts : 3
Reputation : 1
Language : English

Back to top Go down

Solved Re: How do I make it so only a guest can see a certain forum?

Post by Razor12345 October 13th 2023, 9:37 am

Good morning!

1) AP - General - Categories and forums

If you already have a category (not a forum!) for guests - edit it. If not, create one

How do I make it so only a guest can see a certain forum? Scree440

Category name: enter the following in this field

Code:
<div class='guest__category'>NAME CATEGORY</div>

NAME CATEGORY - Your title for this category.

Save.

Next, create forums in this section for guests.

2) AP - Display - Colors&CSS - CSS Stylesheet

Insert this code:

Code:
.forumline {
  visibility: hidden;
}

Save.

3) AP - Modules - Javascript codes management - Create a new Javascript

Title: any
Placement: In all the pages
Javascript Code:

Code:
$(document).ready(function() {
window.addEventListener('DOMContentLoaded', function() {
  const logOut = document.querySelector('#logout');
  const forumCategories = document.querySelectorAll('.forumline');
  const userNick = window._userdata.username;
  const adminNick = 'Admin';
  if (userNick === adminNick) {
    forumCategories.forEach((item) => {
      item.style.visibility = 'visible';
    });
  } else {
  forumCategories.forEach((item) => {
    if (item.querySelector('div.guest__category') && logOut) {
      item.style.display = 'none';
    } else {
  item.style.visibility = 'visible';
  }
  });
  }
 
  });
    });

Save.

In this code

Code:
const adminNick = 'Admin';

instead of Admin, specify your nickname ( in quotes) to have access to the guest sections.

Result:

View for admin

How do I make it so only a guest can see a certain forum? Scree441

View for users:

How do I make it so only a guest can see a certain forum? Scree442

View for guests:

How do I make it so only a guest can see a certain forum? Scree443

P.S. script works with this hierarchy (AP - Display - Structure and hierarchy):

How do I make it so only a guest can see a certain forum? Scree444


How do I make it so only a guest can see a certain forum? Screen51
Razor12345
Razor12345
Support Moderator
Support Moderator

Male Posts : 1583
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine

skouliki, Ape, TonnyKamper and TheSmallestOpp like this post

Back to top Go down

Solved Re: How do I make it so only a guest can see a certain forum?

Post by TheSmallestOpp October 13th 2023, 5:51 pm

Razor12345 wrote:Good morning!

1) AP - General - Categories and forums

If you already have a category (not a forum!) for guests - edit it. If not, create one

How do I make it so only a guest can see a certain forum? Scree440

Category name: enter the following in this field

Code:
<div class='guest__category'>NAME CATEGORY</div>

NAME CATEGORY - Your title for this category.

Save.

Next, create forums in this section for guests.

2) AP - Display - Colors&CSS - CSS Stylesheet

Insert this code:

Code:
.forumline {
  visibility: hidden;
}

Save.

3) AP - Modules - Javascript codes management - Create a new Javascript

Title: any
Placement: In all the pages
Javascript Code:

Code:
$(document).ready(function() {
window.addEventListener('DOMContentLoaded', function() {
  const logOut = document.querySelector('#logout');
  const forumCategories = document.querySelectorAll('.forumline');
  const userNick = window._userdata.username;
  const adminNick = 'Admin';
  if (userNick === adminNick) {
    forumCategories.forEach((item) => {
      item.style.visibility = 'visible';
    });
  } else {
  forumCategories.forEach((item) => {
    if (item.querySelector('div.guest__category') && logOut) {
      item.style.display = 'none';
    } else {
  item.style.visibility = 'visible';
  }
  });
  }
 
  });
    });

Save.

In this code

Code:
const adminNick = 'Admin';

instead of Admin, specify your nickname ( in quotes) to have access to the guest sections.

Result:

View for admin

How do I make it so only a guest can see a certain forum? Scree441

View for users:

How do I make it so only a guest can see a certain forum? Scree442

View for guests:

How do I make it so only a guest can see a certain forum? Scree443

P.S. script works with this hierarchy (AP - Display - Structure and hierarchy):

How do I make it so only a guest can see a certain forum? Scree444
This ended up working, thank you very much!
TheSmallestOpp
TheSmallestOpp
New Member

Male Posts : 3
Reputation : 1
Language : English

Back to top Go down

Solved Re: How do I make it so only a guest can see a certain forum?

Post by Razor12345 October 13th 2023, 6:51 pm

This ended up working, thank you very much!

You are welcome!

If your request is complete, please mark it as Solved.

How do I make it so only a guest can see a certain forum? Scree445

----------

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


How do I make it so only a guest can see a certain forum? Screen51
Razor12345
Razor12345
Support Moderator
Support Moderator

Male Posts : 1583
Reputation : 268
Language : Ukr, Rus, Eng
Location : Ukraine

TheSmallestOpp likes this post

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum