diff --git a/og_moderation.info b/og_moderation.info
index 4915475..c25dd5d 100644
--- a/og_moderation.info
+++ b/og_moderation.info
@@ -1,6 +1,6 @@
 name = Organic groups moderation
 description = "Enable access control for publishing options and revision of group content."
 package = "Organic groups"
-dependencies[] = og
+dependencies[] = og_context
 core = 7.x
 version = VERSION
diff --git a/og_moderation.module b/og_moderation.module
index f1cb1d6..1af740c 100644
--- a/og_moderation.module
+++ b/og_moderation.module
@@ -78,10 +78,10 @@ function og_moderation_form_alter(&$form, &$form_state, $form_id) {
  * Implements hook_node_access_records().
  */
 function og_moderation_node_access_records($node) {
-  if ($node->status == 0 && $gids = og_get_entity_groups('node', $node)) {
+  if ($node->status == 0 && $group_types = og_get_entity_groups('node', $node)) {
     $grants = array();
-    foreach($gids as $group_type => $values) {
-      foreach ($values as $gid) {
+    foreach (array_values($group_types) as $gids) {
+      foreach ($gids as $gid) {
         $grants[] = array(
           'realm' => 'og_view_any_unpublished_' . $node->type . '_content',
           'gid' => $gid,
@@ -101,11 +101,13 @@ function og_moderation_node_access_records($node) {
  */
 function og_moderation_node_grants($account, $op) {
   $grants = array();
-  if ($op == 'view' && $gids = og_get_entity_groups('user', $account)) {
-    $types = (empty($types) || $reset == TRUE) ? node_permissions_get_configured_types() : $types;
-    foreach($types as $type) {
-      foreach ($gids['node'] as $id => $gid) {
-        if (og_user_access('node', $gid, "view any unpublished $type content")) {
+  if ($op == 'view') {
+    $context = og_context();
+    $gid = (isset($context['gid'])) ? $context['gid'] : FALSE;
+    if ($gid) {
+      $types = og_get_all_group_content_bundle();
+      foreach (array_keys($types['node']) as $type) {
+        if (og_user_access('node', $gid, "view any unpublished $type content", $account)) {
           $grants['og_view_any_unpublished_' . $type . '_content'][] = array($gid);
         }
       }
