Jump to main content Jump to doc navigation

modUser::isMember

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

Syntax

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

boolean isMember (mixed $groups)

Example

Get a user object:

$user = $modx->getObject('modUser', array('username' => 'boss'));

See if the User is a member of the 'Staff' user group:

$user->isMember('Staff');

See if the User is a member of EITHER the 'Staff' or 'Investors' user group.

$user->isMember(array('Staff','Investors'));

See if the User is a member of BOTH the 'Staff' and 'Investors' user group.

$user->isMember(array('Staff','Investors'), 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
  • Chris Fickling
  • CrewMark
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

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

Learn more