Examples

Code Snippets

Assigning a user to a group

Get all users in a group

$group = new Groups_Group( $group_id );$users = $group->users;

Get all groups the current user belongs to

$groups_user = new Groups_User( get_current_user_id() );
// get group objects
$user_groups = $groups_user->groups;
// get group ids (user is direct member)
$user_group_ids = $groups_user->group_ids;
// get group ids (user is direct member or by group inheritance)
$user_group_ids_deep = $groups_user->group_ids_deep;