This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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