Important Note: The contents of this document applies ONLY to version 5.x.x of Simple:Press. It likely does NOT apply to version 6.x.x (our latest version).
Description
This function is used to check the authorisation of a user, including guests, for a given permission. The function returns 1 if auth is allowed or 0 if not allowed.
Usage
sp_get_auth($check, $id, $userid)
Arguments
$check
(string) (required) permission to check
Default: None
$id
(integer) (optional) forum id to check the permission against
Default: global – check a global, non forum specific permission
$userid
(integer) (optional) user id of user to check for permission against
Default: current user – if omitted auth check will user the current user
Examples
Check if the current user can ‘move topics’ on a specific forum.
if (!sp_get_auth('move_topics', $id)) { die(); }
Check if the specified user can ‘upload files’ in the specified forum.
if (sp_get_auth('upload_files', $id, $userid)) { ... }
Check if the current is allowed to view the members list. Note, a forum id is not used since this permission is not forum specific.
if (!sp_get_auth('view_members_list')) return;
Special Notes
None.
Source Code
sp_get_auth() is located in simple-press/sp-api/sp-api-auths.php.
Related
None.