function find_all_groups_for_user($user_id) { $result = array(); // Find all possible capabilites $all_groups = Groups_Group::get_groups(); // Iterate, find what capabilites the user has foreach ($all_groups as $group) { $OK = Groups_User_Group::read($user_id, $group->group_id); if ($OK) { $result[] = $group; } } return $result; }