From fdb682577f7efcc798e8e3df7d7dbf16f2480f4b Wed, 5 Oct 2011 22:31:56 +0200
From: casey <caseynotane@live.com>
Date: Wed, 5 Oct 2011 22:31:14 +0200
Subject: [PATCH] http://drupal.org/node/1238186

diff --git a/includes/og.views.inc b/includes/og.views.inc
index d38a34d..48a08de 100644
--- a/includes/og.views.inc
+++ b/includes/og.views.inc
@@ -134,6 +134,30 @@
         );
       }
 
+      $is_group_type = FALSE;
+      foreach ($info['bundles'] as $bundle_name => $bundle_info) {
+        if (og_is_group_type($entity_type, $bundle_name)) {
+          $is_group_type = TRUE;
+          break;
+        }
+      }
+
+      // Group's related entity.
+      if ($is_group_type) {
+        $data['og']['og_related_' . $entity_type] = array(
+          'group' => t('Group'),
+          'title' => t('@entity being the group', array('@entity' => ucfirst($info['label']))),
+          'help' => t('TODO'),
+          'relationship' => array(
+            'handler' => 'views_handler_relationship',
+            'label' => t('@entity being the group', array('@entity' => $entity_type)),
+            'base' => $info['base table'],
+            'base field' => $info['entity keys']['id'],
+            'relationship field' => 'etid',
+          ),
+        );
+      }
+
       // Group membership relationship.
       if ($entity_type != 'og_membership') {
         $title = t('@entity group membership', array('@entity' => ucfirst($info['label'])));
