fetchPermissionPages (function)

Last updated: Mon, Apr 17, 2023 9:32 am
Return to Knowledgebase

Purpose

Retrieves the pages associated with a particular permission ID.

Location

users/helpers/permissions.php

Parameters

# Parameter Data Type Required Description
1 $permission_id integer Yes which is the ID of the permission for which pages need to be fetched

Returns

Data Type Description of Returned Data
array returns an array of page information that includes the page ID, page name, and whether the page is private or not

Example

fetchPermissionPages(1)

Further Documentation:

Here is an example usage of the fetchPermissionPages() function:

// Assume the permission ID is 5
$permission_id = 5;

// Call the function to fetch the pages associated with the permission ID
$pages = fetchPermissionPages($permission_id);

// Loop through the returned array of pages and display their information
foreach ($pages as $page) {
echo "Page ID: " . $page['id'] . "
";
echo "Page Name: " . $page['page'] . "
";
echo "Private Page: " . ($page['private'] ? "Yes" : "No") . "
";
}


This code will fetch all the pages associated with the permission ID 5 and display their information.