Skip to content

Instantly share code, notes, and snippets.

@splittingred
Created June 3, 2011 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save splittingred/1007286 to your computer and use it in GitHub Desktop.
Save splittingred/1007286 to your computer and use it in GitHub Desktop.
Get role of a User in a certain group
<?php
$c = $modx->newQuery('modUserGroupRole');
$c->innerJoin('modUserGroupMember','UserGroupMembers');
$c->innerJoin('modUserGroup','UserGroup','UserGroup.id = UserGroupMembers.user_group');
$c->where(array(
'UserGroupMembers.member' => $userId,
'UserGroup.name' => $userGroupName,
));
$role = $modx->getObject('modUserGroupRole',$c);
return $role ? $role->get('name') : '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment