deletePermission (function)

Last updated: Mon, Apr 17, 2023 7:19 am
Return to Knowledgebase

Purpose

Deletes multiple permission levels

Location

users/helpers/permissions.php

Parameters

# Parameter Data Type Required Description
1 $permission array Yes $permission is an array of integers representing the IDs of the permissions to be deleted.

Returns

Data Type Description of Returned Data
int Returns an integer value that represents the number of permissions deleted.

Example

deletePermission([3,4,5])

Further Documentation:

The deletePermission function is used to delete a permission level from the database. It takes an array of permission IDs as its parameter and returns the number of permissions that were successfully deleted.


// Delete permissions with IDs 4 and 5
$deletedCount = deletePermission([4, 5]);

if ($deletedCount > 0) {
echo "Deleted $deletedCount permissions successfully";
} else {
echo "No permissions were deleted";
}