It is not possible to limit users' ability to create subgroups based on og_user_roles, because the existing logic for the path node/add in og_user_roles_determine_context uses the query parameter 'gids[]' to determine the group that controls user role adjustments, whereas og_subgroups uses 'og_parent'.

This patch adds the appropriate test to og_is_group_post_type, and if og_subgroups is in use, then og_is_group_type is also consulted, and og_parent is used instead of gids to set the appropriate group context.

Comments

greg.1.anderson’s picture

Whoops, wrong patch above. Correct one attached.

greg.1.anderson’s picture

Here is a new patch with one correction and one improvement to the previous one.

Correction: It is necessary to transliterate dashes to underscores in the content type -- "project-project" must become "project_project" before being passed to og_is_group_type or og_is_group_post_type.

Improvement: Somehow I thought that arg(n) would not be available yet, but it is; this patch removes the preg_replace in favor of the old strpos test, and uses arg(2) to pull the content type from the path.