Jump to main content Jump to doc navigation

modResource::isMember

Checks whether a Resource belongs to one or more Resource Groups.

Syntax

boolean isMember (string|array $groups [, boolean $matchAll = false])
Parameter Description
$groups Resource Group name or an array of Resource Group names
$matchAll true — require membership in every group of the array; false (default) — membership in any one group is enough. No effect when $groups is a single string.

Example

Get a Resource object:

$resource = $modx->getObject('modResource', array('id' => 2));

Check membership in the ‘Marketing’ Resource Group:

$resource->isMember('Marketing');

Check membership in either the ‘Marketing’ or the ‘Finances’ Resource Group:

$resource->isMember(array('Marketing', 'Finances'));

Check membership in both Resource Groups at once:

$resource->isMember(array('Marketing', 'Finances'), true);

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more