updatePrivate (function)

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

Purpose

The updatePrivate function in UserSpice is used to update the privacy setting of a page in the database

Location

users/helpers/permissions.php

Parameters

# Parameter Data Type Required Description
1 $id integer Yes The ID of the page to update.
2 $private integer Yes The new privacy setting for the page (0 for public, 1 for private).

Returns

Data Type Description of Returned Data
bool True if the update is successful, false otherwise.

Example

updatePrivate($id, $private)

Further Documentation:

This should only be done through the User Interface.

// Update the privacy setting of a page with ID 1 to private
$pageId = 1;
$private = 1;

$result = updatePrivate($pageId, $private);

if ($result) {
echo "Privacy setting updated successfully.";
} else {
echo "Failed to update privacy setting.";
}



In the example above, the updatePrivate function is called to update the privacy setting of a page with ID 1 to private. The new privacy setting is specified as 1. The return value, $result, indicates whether the update operation was successful or not. Based on the result, an appropriate message is displayed to indicate the outcome of the privacy setting update.