PHP code example of sunlab / wn-permissions-plugin
1. Go to this page and download the library: Download sunlab/wn-permissions-plugin library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sunlab / wn-permissions-plugin example snippets
if ($user->hasUserPermission(['can-eat-cake', 'can-take-cheese'])) {
// This user has all above permissions
} else {
// This user does not have permission
}
if ($user->hasUserPermission(['can-eat-cake', 'can-take-cheese'], 'one')) {
// This user has one of the above permissions
} else {
// This user does not have permission
}