stripPagePermissions (function)

Last updated: Fri, May 26, 2023 10:36 am
Return to Knowledgebase

Purpose

The stripPagePermissions function in UserSpice is used to remove page permissions for a given page ID.

Location

users/helpers/us_helpers.php

Parameters

# Parameter Data Type Required Description
1 $id integer Yes The ID of the page.

Returns

Data Type Description of Returned Data
bool Returns true on success, false on failure.

Further Documentation:

// Remove page permissions for a specific page ID
$pageId = 123;

$success = stripPagePermissions($pageId);

if ($success) {
echo "Page permissions removed successfully.";
} else {
echo "Failed to remove page permissions.";
}



In the example above, the stripPagePermissions function is called to remove page permissions for a specific page identified by its ID ($pageId). The function executes a database query to delete the corresponding entries in the permission_page_matches table. The function returns a boolean value indicating the success or failure of the operation. In the example, the result is stored in the $success variable and is used to display an appropriate message to the user.

Note: Make sure to adjust the $pageId variable with the actual ID of the page you want to remove permissions for.