Function __global->has_privilege

Definitions

sources/permissions.php

  • Find if a member has a specified privilege.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$member_id MEMBER No No required parameter N/A N/A The member being checked whether to have the privilege
$privilege ID_TEXT No No required parameter N/A N/A The privilege being checked for
$page ?ID_TEXT No No Null N/A N/A The page being checked (null: current page)
$cats ?mixed No No Null N/A N/A A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...), or a string of the cat type if you will accept overrides in any matching cat (null: N/A)

Returns

  • Whether the member has the privilege
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Find if a member has a specified privilege.
 *
 * @param  MEMBER $member_id The member being checked whether to have the privilege
 * @param  ID_TEXT $privilege The privilege being checked for
 * @param  ?ID_TEXT $page The page being checked (null: current page)
 * @param  ?mixed $cats A list of cat details to require access to (c-type-1,c-id-1,c-type-2,c-d-2,...), or a string of the cat type if you will accept overrides in any matching cat (null: N/A)
 * @return boolean Whether the member has the privilege
 */

function has_privilege(int $member_id, string $privilege, ?string $page = null, $cats = null) : bool