Viewing 4 replies - 1 through 4 (of 4 total)
  • I just want to second this. It would be helpful for people who want to integrate Groups with my Nav Menu Roles plugin.

    If you are looking to print the list of a user’s groups to the screen, there is a shortcode for that per the documentation:

    [groups_user_groups] – Lists the current user’s or a specific user’s groups.

    If you want to do it via your own code, take a look at class-groups-shortcodes.php in plugins/groups/lib/views/ and see how the author uses a SELECT query to pull those. Perhaps a direct database query is not ideal from our perspective but it works.

    Also, just figured out that this will return an array of the groups of the specified user if you know the User ID:

    $user = new Groups_User( $user_id );
    			$groups = $user->groups;
    
    			print_r($groups);

    Try it in your theme’s functions.

    Thanks for sharing that. I think I mis-typed… I actually need a way to list all the available groups. Well, I don’t personally, but those using Nav Menu Roles plugin in conjunction with Groups would benefit.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘list of groups’ is closed to new replies.