• PHP reference
  • Sandbox

API

class Sandbox\API

Adds additional methods for processing API requests.

Methods

error(integer $id)

Output an error using an error code (integer) or by using a message.

Parameters

  • integer $id Error ID

boolean isTrue($input)

Check if an input variable evaluates to true, by checking if it is bool true, integer 1, string '1', string 'true' or string 'yes'.

Parameters

  • $input

Return Value

  • boolean

sendNotifications(integer[] $users, string $body, string $link, mixed $context = null)

Helper function for sending notifications to users. Accepts an array of user ID's, string $body, which holds the text of the notification, and a $link.

Parameters

  • integer[] $users List of user IDs
  • string $body
  • string $link
  • mixed $context

authenticate_manager()

Check if the current user is a manager of the Community.

If not, die with permissions error (Error ID 1018).