diff --git a/og.module b/og.module index e6ebeae..0dfa3ae 100644 --- a/og.module +++ b/og.module @@ -522,7 +522,17 @@ function og_node_access($node, $op, $account) { // Set the "field mode" to default, before passing it to the // selection handler. $instance['field_mode'] = 'default'; - if (entityreference_get_selection_handler($field, $instance)->getReferencableEntities()) { + + if (module_exists('entityreference_prepopulate')) { + if ($ids = entityreference_prepopulate_get_values_from_url($field, $instance, TRUE)) { + foreach($ids as $gid) { + if(entityreference_get_selection_handler($field, $instance)->getReferencableEntities() && og_is_member('node', $gid, 'user', $account) && og_user_access('node', $gid, "$op $type content")) { + return NODE_ACCESS_ALLOW; + } + } + } + } + else if (entityreference_get_selection_handler($field, $instance)->getReferencableEntities()) { return NODE_ACCESS_ALLOW; }