when a comment is being added on a page that is not part of its parent entity there is no function for looking up the og of the parent comment and modules like notifications_team can not retrieve that info.
the menu structure, comment/reply/1/1 requires a contextual hook.
This issue has come up in response to #1861400: Limit List of Users Based on Organic Groups Context.
I made an extension module http://drupal.org/project/og_context_comment here. In the issue #1868288: Provide as patch for OG core, Amitaibu asked me to patch og_context core and provide it so this is a place holder for my patch.

Files: 
CommentFileSizeAuthor
#8 1876740-og-context-comment-8.patch1.61 KBAmitaibu
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#7 comment_handler-1876740-7.patch1.69 KBsanguis
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#3 comment_handler-1876740-3.patch1.57 KBsanguis
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]
#1 comment_handler-1876740-2.patch2.01 KBsanguis
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new2.01 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

patch file here.

Status:Needs review» Needs work

+++ b/og_context/og_context.moduleundefined
@@ -138,6 +138,13 @@ function og_context_og_context_negotiation_info() {
+  $providers['add_comment'] = array(

add_comment => comment

+++ b/og_context/og_context.moduleundefined
@@ -138,6 +138,13 @@ function og_context_og_context_negotiation_info() {
+    'description' => t("Determine context by checking if the parent entity of the comment belongs to a group"),

parent entity => parent content

+++ b/og_context/og_context.moduleundefined
@@ -457,6 +464,39 @@ function og_context_handler_user_edit() {
+  $comment_path = explode('/', request_path());

Better use menu_get_object() and/ or menu_get_item()

+++ b/og_context/og_context.moduleundefined
@@ -457,6 +464,39 @@ function og_context_handler_user_edit() {
+    if ($node) {
+      return _group_context_handler_entity('node', $node);
+    }
+
+    // The path may not be %node, but in fact is a ctools-context, so extract the
+    // node from it. We check only the 1st position (e.g. node/%/foo).
+    $item = menu_get_item();
+    if (empty($item['map'][1]) || !is_object($item['map'][1]) || !($item['map'][1] instanceof ctools_context)) {
+      return;
+    }
+
+    // Check the context is a node type. We check only path similar to node/%/foo
+    // and don't traverse over the whole arguments, as it might be a page manager
+    // page passing multiple nodes (e.g. some/path/with/%node/%node). Implementing
+    // modules wanting to handle the above example, should implement their own
+    // context handler.
+    $context = clone $item['map'][1];
+    if (empty($context->type[0]) || $context->type[0] != 'entity:node') {
+      return;
+    }
+    return _group_context_handler_entity('node', $context->data);

This part is copied from og_context_handler_node() -- better split it, so we don't duplicate code.

StatusFileSize
new1.57 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

okay done, thanks for the guidance.

Status:Needs work» Needs review

Status:Needs review» Needs work

A little more polish :)

+++ b/og_context/og_context.moduleundefined
@@ -138,6 +138,13 @@ function og_context_og_context_negotiation_info() {
+    'callback' => 'og_context_handler_add_comment',

Callback should be og_context_handler_comment

+++ b/og_context/og_context.moduleundefined
@@ -405,8 +412,12 @@ function og_context_handler_url() {
+function og_context_handler_node($node = NULL) {

Missing PHPdocs.

+++ b/og_context/og_context.moduleundefined
@@ -405,8 +412,12 @@ function og_context_handler_url() {
+  if (!is_null($node)) {

instead of is_null, you can use empty($node) -- that's how it's usually done in core.

+++ b/og_context/og_context.moduleundefined
@@ -405,8 +412,12 @@ function og_context_handler_url() {
+  elseif ($node = menu_get_object('node')) {

menu_get_object() (without 'node') is enough.

+++ b/og_context/og_context.moduleundefined
@@ -457,6 +468,20 @@ function og_context_handler_user_edit() {
+  $comment = comment_load(end($comment_path['original_map']));

$move the end(..) part to own variable ($cid).

+++ b/og_context/og_context.moduleundefined
@@ -457,6 +468,20 @@ function og_context_handler_user_edit() {
+  if (isset($comment->nid)) {
+    return og_context_handler_node(node_load($comment->nid));
+  }
+  else {
+    return;
+  }

This can be in one line return !empty($comment->nid) ? .. : ...;

+++ b/og_context/og_context.moduleundefined
@@ -405,8 +412,12 @@ function og_context_handler_url() {
+  elseif ($node = menu_get_object('node')) {

menu_get_object() (without 'node') is enough.

this is from the original function:

-function og_context_handler_node() {
-  if ($node = menu_get_object('node')) {

Are you sure that this should be modified?

Status:Needs work» Needs review
StatusFileSize
new1.69 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

regardless here is the new patch.

StatusFileSize
new1.61 KB
PASSED: [[SimpleTest]]: [MySQL] 745 pass(es).
[ View ]

Cleaned up code.

Status:Needs review» Fixed

Committed.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.