Skip to content

Instantly share code, notes, and snippets.

@steppohub
Created December 4, 2015 02: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 steppohub/9ff217702a00d7aa1869 to your computer and use it in GitHub Desktop.
Save steppohub/9ff217702a00d7aa1869 to your computer and use it in GitHub Desktop.
<?php $user_id = get_current_user_id();
$groups_user = new Groups_User( $user_id );
$groups = $groups_user->groups;
$my_groups = array();
foreach($groups as $g) {
$my_groups[] = $g->name;
}
$my_groups = implode(', ', $my_groups);
// And then you can access the groups that the user belongs to using
echo '<p>All applicable customer groups: '.$my_groups.'</p>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment