Problem/Motivation

There is (to my knowledge) currently no way to allow group members to view unpublished content within their group(s).

Many of the workflow modules (e.g. Workflow, Workbench Moderation etc) work by publishing and unpublishing nodes. In order to effectively use these modules in combination with OG, there needs to be a way to grant view access to unpublished group content.

Proposed resolution

Add a new global OG permission called "View unpublished group content".

Remaining tasks

Currently unknown.

User interface changes

As previously descibed, add a new permission in the golbal permissions screen.

API changes

Currently unknown.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shenzhuxi’s picture

this patch only work for 7.x-1.3.
7.x-1.x was already quit different.

shenzhuxi’s picture

this patch only work for 7.x-1.3.
7.x-1.x was already quit different.

amitaibu’s picture

Status: Active » Needs review

Setting correct status.

amitaibu’s picture

Can you re-roll it against 2.x and 1.x -dev versions?

Status: Needs review » Needs work

The last submitted patch, og-view-unpublished-1414002.patch, failed testing.

shenzhuxi’s picture

bonobo’s picture

Amitai - are you still looking for a 2.x version of this? We are running into this, and could roll a patch if this is something that still is of interest.

amitaibu’s picture

Version: 7.x-1.3 » 7.x-2.x-dev

@bonobo,

Yes, lets get it in, it can help with workflows. Also it would be nice to cover it also in OG-access.

bonobo’s picture

Does it make sense for this to be part of OG, or should we let something like OG Moderation handle this?

amitaibu’s picture

Oh, forgot about OG-moderation, yeah it should probably go there.

StephenRobinson’s picture

Made a simple patch to og.module:

/**
 * Implement hook_node_access()
 */
function og_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
  $status=1;
  if(isset($node->status)){
    $status=$node->status;
  }
  // if (in_array($op, array('update', 'delete'))) { // removed 
  if ((in_array($op, array('update', 'delete'))) || ($status==0 && $op=='view' && $type=='group') ) {
StephenRobinson’s picture

had to fix this in 2.3 as well....

/**
 * Implements hook_node_access().
 */
function og_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : (is_array($node) ? $node['type'] : $node->type);
 + $status = is_string($node) ? $node : (is_array($node) ? $node['status'] : $node->status); // added
.
.
.
-  elseif (in_array($op, array('update', 'delete'))) {
+  // elseif (in_array($op, array('update', 'delete'))) { // removed
+  elseif ((in_array($op, array('update', 'delete'))) || ($status==0 && $op=='view' && $type=='group') ) { // added
bochita00’s picture

Issue summary: View changes

Is there a stable solution for this?