Skip to content

Permissions Filters

8 unique filter hooks currently map to this category, across 22 call sites.

Hook Inventory

HookEditionCall SitesFirst Source
fluent_community/can_access_portalCore8fluent-community/app/Services/Helper.php:526
fluent_community/can_view_comments_{feed}Core1fluent-community/app/Http/Controllers/CommentsController.php:31
fluent_community/can_view_leaderboard_membersCore3fluent-community/app/Functions/Utility.php:313
fluent_community/can_view_members_pageCore3fluent-community/app/Functions/Utility.php:298
fluent_community/can_view_user_profileCore3fluent-community/app/Functions/Utility.php:328
fluent_community/super_admin_capabilityCore1fluent-community/app/Services/Helper.php:229
fluent_community/user/permissionsCore2fluent-community/app/Models/User.php:499
fluent_community/user/space/permissionsCore1fluent-community/app/Models/User.php:637

fluent_community/can_access_portal

  • Type: filter
  • Edition: Core
  • Call sites: 8
  • When it fires: Filters whether a user may access the community portal at all.

Applied at every return point of Helper::canAccessPortal(), so a callback sees the decision but not the reason behind it — the access level, role check and active-profile check are all collapsed into one boolean by the time it runs. No user ID is passed, so resolve the subject yourself if you need it. A callback that unconditionally returns true opens the portal to logged-out visitors as well.

Parameters

#NameTypeDescription
1$canAccessboolThe decision reached from the access level, role list and profile status.

Return: booltrue to allow portal access, false to deny. The value is used directly, so return a real boolean.

Call Sites

EditionSourceParameters
Corefluent-community/app/Services/Helper.php:526true (bool)
Corefluent-community/app/Services/Helper.php:534false (bool)
Corefluent-community/app/Services/Helper.php:538true (bool)
Corefluent-community/app/Services/Helper.php:542true (bool)
Corefluent-community/app/Services/Helper.php:550false (bool)
Corefluent-community/app/Services/Helper.php:556false (bool)
Corefluent-community/app/Services/Helper.php:560true (bool)
Corefluent-community/app/Services/Helper.php:567$result (mixed)

Example

php
add_filter('fluent_community/can_access_portal', function ($canAccess) {
    return $canAccess;
}, 10, 1);

Related: fluent_community/super_admin_capability

fluent_community/can_view_comments_{feed}

  • Type: filter
  • Edition: Core
  • Call sites: 1
  • When it fires: Dynamic filter deciding whether the comment list for a post or lesson is returned at all.

The placeholder is $feed->type, so in practice it is fluent_community/can_view_comments_text for ordinary posts and fluent_community/can_view_comments_course_lesson for lesson discussions — there is no un-suffixed variant to hook. Returning false makes the endpoint respond with an empty comments array rather than an error, so the client shows a post with no comments instead of a permission message. The post has already passed its own visibility check by then.

Parameters

#NameTypeDescription
1$canViewCommentsboolWhether to return the comments. true by default.
2$feed\FluentCommunity\App\Models\FeedThe post or lesson the comments belong to.

Return: bool — a falsy value yields an empty comment list, not a 403.

Call Sites

EditionSourceParameters
Corefluent-community/app/Http/Controllers/CommentsController.php:31true (bool)
$feed (Feed)

Example

php
add_filter('fluent_community/can_view_comments_{feed}', function ($canViewComments, $feed) {
    return $canViewComments;
}, 10, 2);

Related: fluent_community/user/space/permissions

fluent_community/can_view_leaderboard_members

  • Type: filter
  • Edition: Core
  • Call sites: 3
  • When it fires: Filters whether the current user may see the member list on the leaderboard.

Reads the leaderboard_members_visibility privacy setting and otherwise mirrors the members-page check. It controls visibility of the ranked members, not whether the leaderboard feature itself is enabled.

Parameters

#NameTypeDescription
1$canViewboolThe decision derived from the privacy setting.
2$pageStatusstringThe leaderboard_members_visibility setting: everybody, logged_in, or a moderator-only value.

Return: booltrue to allow viewing.

Call Sites

EditionSourceParameters
Corefluent-community/app/Functions/Utility.php:313true (bool)
$pageStatus (mixed)
Corefluent-community/app/Functions/Utility.php:317is_user_logged_in() (mixed)
$pageStatus (mixed)
Corefluent-community/app/Functions/Utility.php:320Helper::isModerator() (mixed)
$pageStatus (mixed)

Example

php
add_filter('fluent_community/can_view_leaderboard_members', function ($canView, $pageStatus) {
    return $canView;
}, 10, 2);

Related: fluent_community/can_view_members_page

fluent_community/can_view_members_page

  • Type: filter
  • Edition: Core
  • Call sites: 3
  • When it fires: Filters whether the current user may view the members directory.

Driven by the members_page_status privacy setting, with the same three-way shape as the profile and leaderboard checks. It gates the directory page only; individual profiles are governed separately by fluent_community/can_view_user_profile.

Parameters

#NameTypeDescription
1$canViewboolThe decision derived from the privacy setting.
2$pageStatusstringThe members_page_status setting: everybody, logged_in, or a moderator-only value.

Return: booltrue to allow viewing.

Call Sites

EditionSourceParameters
Corefluent-community/app/Functions/Utility.php:298true (bool)
$pageStatus (mixed)
Corefluent-community/app/Functions/Utility.php:302is_user_logged_in() (mixed)
$pageStatus (mixed)
Corefluent-community/app/Functions/Utility.php:305Helper::isModerator() (mixed)
$pageStatus (mixed)

Example

php
add_filter('fluent_community/can_view_members_page', function ($canView, $pageStatus) {
    return $canView;
}, 10, 2);

Related: fluent_community/can_view_user_profile · fluent_community/can_view_leaderboard_members

fluent_community/can_view_user_profile

  • Type: filter
  • Edition: Core
  • Call sites: 3
  • When it fires: Filters whether the current user may view a member profile page.

The base decision comes from the profile_page_visibility privacy setting: everybody yields true, logged_in yields the login state, and anything else falls back to "own profile or moderator". $pageStatus is passed so a callback can relax one visibility mode without hard-coding the others. $targetUserId is frequently null — the own-profile branch compares it with a strict ===, so a string ID will not match.

Parameters

#NameTypeDescription
1$canViewboolThe decision derived from the privacy setting.
2$pageStatusstringThe profile_page_visibility setting: everybody, logged_in, or a moderator-only value.
3$targetUserIdintThe profile owner's user ID. May be null when the caller did not supply one.

Return: booltrue to allow viewing.

Call Sites

EditionSourceParameters
Corefluent-community/app/Functions/Utility.php:328true (bool)
$pageStatus (mixed)
$targetUserId (int)
Corefluent-community/app/Functions/Utility.php:332is_user_logged_in() (mixed)
$pageStatus (mixed)
$targetUserId (int)
Corefluent-community/app/Functions/Utility.php:337($isOwn || Helper::isModerator()) (mixed)
$pageStatus (mixed)
$targetUserId (int)

Example

php
add_filter('fluent_community/can_view_user_profile', function ($canView, $pageStatus, $targetUserId) {
    return $canView;
}, 10, 3);

Related: fluent_community/can_view_members_page

fluent_community/super_admin_capability

  • Type: filter
  • Edition: Core
  • Call sites: 1
  • When it fires: Filters the WordPress capability that identifies a FluentCommunity super admin.

Defaults to manage_options and is checked with user_can(). Returning an empty or falsy value makes Helper::isSuperAdmin() return false for everyone, which disables the super-admin escape hatch across the plugin — that is the supported way to switch it off, not an error. This is distinct from the community admin role, which is stored per member rather than derived from WordPress capabilities.

Parameters

#NameTypeDescription
1$capabilitystringThe capability to test, manage_options by default.

Return: string — a WordPress capability name, or a falsy value to disable the super-admin check entirely.

Call Sites

EditionSourceParameters
Corefluent-community/app/Services/Helper.php:229'manage_options' (string)

Example

php
add_filter('fluent_community/super_admin_capability', function ($capability) {
    return $capability;
}, 10, 1);

Related: fluent_community/user/permissions

fluent_community/user/permissions

  • Type: filter
  • Edition: Core
  • Call sites: 2
  • When it fires: Filters the permission map derived from a user's community roles.

Applied at both ends of User::getRolePermissions(). Users with no community role reach the early branch and receive only ['read' => true] with an empty $roles array, so a callback must cope with a map that has none of the usual keys. The result is cached per user for the request and is what the Vue app receives as appVars.permissions, so anything added here becomes visible to the front end.

Parameters

#NameTypeDescription
1$permissionsarrayPermission keys mapped to booleans, for example community_admin, delete_any_feed, course_creator.
2$rolesarrayThe user's community role slugs. Empty for users with no community role.
3$user\FluentCommunity\App\Models\UserThe user the permissions belong to.

Return: array — the permission map. Keep the existing keys unless you intend to revoke them; several controllers read them directly.

Call Sites

EditionSourceParameters
Corefluent-community/app/Models/User.php:499[ 'read' => true, ] (array)
$roles (mixed)
$this (mixed)
Corefluent-community/app/Models/User.php:526$permissions (mixed)
$roles (mixed)
$this (mixed)

Example

php
add_filter('fluent_community/user/permissions', function ($permissions, $roles, $user) {
    return $permissions;
}, 10, 3);

Related: fluent_community/super_admin_capability

fluent_community/user/space/permissions

  • Type: filter
  • Edition: Core
  • Call sites: 1
  • When it fires: Filters the permission map a user holds inside one particular space.

Distinct from the site-wide fluent_community/user/permissions: this is resolved per space and per role, and it is what the front end receives on each space object. Two very different maps reach it — non-members get a short read-only set, while members and moderators get the full one with community_admin, the *_any_feed and *_any_comment keys and the membership flags — so check for a key before relying on it. is_member is added just before the filter and is the reliable way to tell the two apart. Several controllers read these keys directly for authorisation, so removing one denies access rather than merely hiding a control.

Parameters

#NameTypeDescription
1$permissionsarrayPermission keys mapped to booleans for this space.
2$space\FluentCommunity\App\Models\BaseSpaceThe space the permissions apply to.
3$rolestringThe user's role in the space: admin, moderator, member, student, or empty for a non-member.
4$user\FluentCommunity\App\Models\UserThe user the permissions belong to.

Return: array — the permission map.

Call Sites

EditionSourceParameters
Corefluent-community/app/Models/User.php:637$permissions (mixed)
$space (Space)
$role (mixed)
$this (mixed)

Example

php
add_filter('fluent_community/user/space/permissions', function ($permissions, $space, $role, $user) {
    return $permissions;
}, 10, 4);

Related: fluent_community/user/permissions

FluentCommunity developer documentation