How does phpbb3 know if a forum is private?
I have a phpbb3 message board installed with 2 forums -
- Public Discussion
- Private Discussion
Everyone can see the public forum, but only a specific group can see the private forum.
What is and where is the variable stored that phpbb uses to d开发者_如何学编程istinguish between the private and public forum?
Thanks!
Generally, forum visibility is based on two things:
- A user being in a particular user group
- That group having permission to see that forum.
You'll find the controls for this in the admin interface. In "Forum Permissions" you'll see a list of the groups who have some kind of role that will allow them to at least see the forum (top-right box.) In "Manage Groups" or under the individual user management, you'll be able to see which user belongs to which group.
Although things can be controlled at a much finer grain if necessary, that's the normal basic setup. If a user is in a group, and that group has permission to see the forum (the group has a "role" that can see it), then the user can see the forum.
There's no one variable to control this. The groups and forum permissions live in the database.
While there's lots of different ways of setting things up, I'm guessing the "variable" you're looking is probably the database table phpbb_acl_groups
, where a row can associate a forum (identified by a forum_id
from phpbb_forums
) with a role (auth_role_id
from phpbb_acl_roles
) and a group (group_id
from phpbb_groups
.)
I think that's the best answer I can give unless you can give us some more detail (e.g. what the actual problem is...)
Working on Matt's answer, I've come up with this query:
SELECT f.forum_id, f.forum_name
FROM forums f
WHERE f.forum_type = 1 AND f.forum_id IN (
SELECT a.forum_id
FROM acl_groups a
WHERE a.group_id = 1 AND (a.auth_role_id <> 16)
)
This will select the forums which are not categories (f.forum_type = 1
) and a visitor does not have the ROLE_FORUM_NOACCESS
(a.auth_role_id <> 16
) set.
I've considered to add the f_read
option (a.auth_option_id <> 20
), but this didn't change anything in my case.
I'd like to know if this is a bad idea :p
精彩评论