Jump to main content Jump to doc navigation

modResource::isMember

States whether a resource is a member of a resource group or groups. You may specify either a string name of the resource group, or an array of resource group names.

This method is available with MODX v2.3 (most likely not in a patch release)

Syntax

API Doc: http://api.modx.com/revolution/2.2/db_core_model_modx_modresource.class.html#\\modResource::isMember()

boolean isMember (mixed $groups)

Example

Get a resource object:

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

See if the resource is a member of the 'Marketing' resource group:

$resource->isMember('Marketing');

See if the resource is a member of EITHER the 'Marketing' or 'Finances' resource group.

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

See if the resource is a member of BOTH the 'Marketing' and 'Finances' resource group (by default it's enough to be in one resource group to get back true).

$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
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • eydolan
  • Lefthandmedia
  • Murray Wood
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

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

Learn more