Unofficial SMF API Documentation

./Sources/ManagePermissions.php

ModifyPermissions

function ModifyPermissions(): void

Dispatches to the right function based on the given subaction.

Checks the permissions, based on the sub-action. Called by ?action=managepermissions.

Uses ManagePermissions language file.

Integration hooks
integrate_manage_permissions

PermissionIndex

function PermissionIndex(): void

Sets up the permissions by membergroup index page.

Called by ?action=managepermissions Creates an array of all the groups with the number of members and permissions.

Uses ManagePermissions language file. Uses ManagePermissions template file.

PermissionByBoard

function PermissionByBoard(): void

Handle permissions by board… more or less. :P

SetQuickGroups

function SetQuickGroups(): void

Handles permission modification actions from the upper part of the permission manager index.

ModifyMembergroup

function ModifyMembergroup(): void

Initializes the necessary to modify a membergroup’s permissions.

ModifyMembergroup2

function ModifyMembergroup2(): void

This function actually saves modifications to a membergroup’s board permissions.

GeneralPermissionSettings

function GeneralPermissionSettings(bool $return_config = false): void|array

A screen to set some general settings for permissions.

Type Parameter Description
bool $return_config Whether to return the $config_vars array (used for admin search)
Integration hooks
integrate_modify_permission_settings
integrate_save_permission_settings

setPermissionLevel

function setPermissionLevel(string $level, int $group, string|int $profile = 'null'): void

Set the permission level for a specific profile, group, or group for a profile.

Type Parameter Description
string $level The level (‘restrict’, ‘standard’, etc.)
int $group The group to set the permission for
string|int $profile The ID of the permissions profile or ‘null’ if we’re setting it for a group
Integration hooks
integrate_load_permission_levels

loadAllPermissions

function loadAllPermissions(): void

Load permissions into $context[‘permissions’].

Integration hooks
integrate_load_permissions

init_inline_permissions

function init_inline_permissions(array $permissions, array $excluded_groups = array()): void

Initialize a form with inline permissions settings.

It loads a context variable for each permission. This function is used by several settings screens to set specific permissions.

To exclude groups from the form for a given permission, add the group IDs as an array to $context[‘excluded_permissions’][$permission]. For backwards compatibility, it is also possible to pass group IDs in via the $excluded_groups parameter, which will exclude the groups from the forms for all of the permissions passed in via $permissions.

Type Parameter Description
array $permissions The permissions to display inline
array $excluded_groups The IDs of one or more groups to exclude
     
    Uses ManagePermissions language
    Uses ManagePermissions template

theme_inline_permissions

function theme_inline_permissions(string $permission): void

Show a collapsible box to set a specific permission.

The function is called by templates to show a list of permissions settings. Calls the template function template_inline_permissions().

Type Parameter Description
string $permission The permission to display inline

save_inline_permissions

function save_inline_permissions(array $permissions): void

Save the permissions of a form containing inline permissions.

Type Parameter Description
array $permissions The permissions to save

loadPermissionProfiles

function loadPermissionProfiles(): void

Load permissions profiles.

EditPermissionProfiles

function EditPermissionProfiles(): void

Add/Edit/Delete profiles.

updateChildPermissions

function updateChildPermissions(?array $parents, ?int $profile = null): void|false

This function updates the permissions of any groups based off this group.

Type Parameter Description
null|array $parents The parent groups
null|int $profile the ID of a permissions profile to update

loadIllegalPermissions

function loadIllegalPermissions(): void

Load permissions someone cannot grant.

Integration hooks
integrate_load_illegal_permissions

loadIllegalGuestPermissions

function loadIllegalGuestPermissions(): void

Loads the permissions that can not be given to guests.

Stores the permissions in $context[‘non_guest_permissions’]. Also populates $context[‘permissions_excluded’] with the info.

Integration hooks
integrate_load_illegal_guest_permissions

loadIllegalBBCHtmlGroups

function loadIllegalBBCHtmlGroups(): void

Loads a list of membergroups who cannot be granted the bbc_html permission.

Stores the groups in $context[‘permissions_excluded’][‘bbc_html’].

removeIllegalBBCHtmlPermission

function removeIllegalBBCHtmlPermission(bool $reload = false): void

Removes the bbc_html permission from anyone who shouldn’t have it

Type Parameter Description
bool $reload Before acting, refresh the list of membergroups who cannot be granted the bbc_html permission

updateBoardManagers

function updateBoardManagers(): void

Makes sure $modSettings[‘board_manager_groups’] is up to date.

ModifyPostModeration

function ModifyPostModeration(): void

Present a nice way of applying post moderation.

Integration hooks
integrate_post_moderation_mapping

Suggest an edit to this page on GitHub