First, thanks for the modules, it's a huge help.

Second, I'll explain the scenario i'm using:

I have 3 content types: Company, Project and Document.
Company is the designated "Group type ".
Project and document are "Group content type".
A Company has many projects and documents belong to projects.
So Document has both a Group audience field and a Reference from URL field.

In the Document type 's reference field I selected "Create link on the full view".
and so when I'm on the parent Project page, i have a link "Add Document" with a
query that looks like this:

ex: node/add/document/23?gids[0]=2

Unfortunatly when I click on the link, the Group audience options is not selecting the right group.
Then I looked inside the function og_get_context_by_url() and the comments say:

* You can pass a URL in in the form of
* node/add/post?gids_group[]=1,2,3&gids_node[]=4,5,6

So if I replace gids[0] with gids_group[0], it works!

The easiest thing for me to do was to generate a template for the content type Project and write my own link:

$query = array('query' => array(
'gids_group[0]' => $_SESSION['og_context']),
'destination' => "node/".$node->nid
);
echo l(t("Add document"), "node/add/document/$node->nid", $query);

I had to stop the investigation and use this fix but I'm wondering if there's a better fix ?