hasPermission

Description

Function which checks if the logged in person has a certain capability/permission to view a particular screen, content, etc.

Usage

<?php hasPermission($perm); ?>

Parameters

$perm (string) (required) The permission/capability that should be checked for.

Return Values

(boolean) Return true if user has the capability and false otherwise.

Example

Do a simple check to see if a logged in person has permission to edit_settings.

if(hasPermission('edit_settings')) {

// do stuff here

}

Change Log

Since 1.0.0

Source File

hasPermission() is located in app/functions/auth-function.php.