Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.