class VisibilityNormalizes and evaluates forum visibility (read access) and posting/reply policies.
class final
- Full name
Kernowdev\ClanbiteForums\Forums\Visibility
Constants
| Name | Value | Description |
|---|---|---|
VIS_PUBLIC | 'public' | |
VIS_LOGGED_IN | 'logged_in' | |
VIS_PRIVATE | 'private' | |
VIS_ROLES | 'roles' | Category-only: viewer must have at least one role listed in category_visibility_roles(). |
VIS_AUTHOR_MODS | 'author_moderators' | Topic-only: only the topic author and forum/site staff may reply. |
Methods
category_visibility_roles()Role slugs allowed to view a category when visibility is self::VIS_ROLES.category_visibility()Visibility stored on a forum category row (defaults for legacy rows).forum_post_topics_visibility()Who may create topics in this forum (stored column; defaults to public).forum_visibility()Visibility stored on a forum row (defaults for legacy rows).normalize_category_visibility()Sanitize category visibility (includes self::VIS_ROLES; forums use self::normalize() only).normalize_post_topics_visibility()Sanitize who may create topics in a forum (same enum as normalize()).normalize_reply_visibility()Sanitize who may reply in a topic.normalize()Sanitize a visibility string.sanitize_category_roles_json()Encode role slugs for DB storage (JSON array).topic_reply_visibility()Who may reply in this topic (stored column; defaults to public).user_can_post_topic()Whether the user may create new topics in this forum.user_can_reply_in_topic()Whether the user may post a reply in this topic.user_can_view_category()Whether the viewer may see a published category (and forums grouped under it) on the front end.user_can_view_forum()Whether the viewer may read content in this forum.user_has_any_role()Whether the user has any of the given role slugs (explicit roles only).
Defined in inc/Forums/Visibility.php