Function __global->add_privilege

Definitions

sources/permissions3.php

  • Add a privilege, and apply it to every usergroup.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$section ID_TEXT No No required parameter N/A N/A The section the privilege is filled under
$name ID_TEXT No No required parameter N/A N/A The codename for the privilege
$default boolean No No False N/A N/A Whether this privilege is granted to all usergroups by default
$not_even_mods boolean No No False N/A N/A Whether this privilege is not granted to supermoderators by default (something very sensitive); only applies if $default is true
$not_for_probation boolean No No False N/A N/A An exception for if $default is true, don't assign the privilege to the probation group
$insert boolean No No True N/A N/A Whether to insert into the database (if this is set to false you need to read the return parameters and do it yourself - which is used for efficient bulk inserts across many privileges at once)

Returns

  • A pair: The map parameter for the group_privileges table, the map parameter for the privilege_list table
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Add a privilege, and apply it to every usergroup.
 *
 * @param  ID_TEXT $section The section the privilege is filled under
 * @param  ID_TEXT $name The codename for the privilege
 * @param  boolean $default Whether this privilege is granted to all usergroups by default
 * @param  boolean $not_even_mods Whether this privilege is not granted to supermoderators by default (something very sensitive); only applies if $default is true
 * @param  boolean $not_for_probation An exception for if $default is true, don't assign the privilege to the probation group
 * @param  boolean $insert Whether to insert into the database (if this is set to false you need to read the return parameters and do it yourself - which is used for efficient bulk inserts across many privileges at once)
 * @return array A pair: The map parameter for the group_privileges table, the map parameter for the privilege_list table
 */

function add_privilege(string $section, string $name, bool $default = false, bool $not_even_mods = false, bool $not_for_probation = false, bool $insert = true) : array