Hello,

I'm trying to write a patch to make view_unpublished 6.x-1.0 allow users to view webform (6.x-3.9) results. View_unpublished works by modifying node_access to return true if the user has the perms it creates. If you give a role the right perms, view_unpublished allows them to view the webform information and the node data of an unpublished webform node. However, users of that role are unable to view the results of that webform.

The access callback for viewing webform results looks like this:

function webform_results_access($node, $account = NULL) {
  global $user;
  $account = isset($account) ? $account : $user;

  $module_access = count(array_filter(module_invoke_all('webform_results_access', $node, $account))) > 0;

  return node_access('view', $node, $account) && ($module_access || user_access('access all webform results', $account) || (user_access('access own webform results', $account) && $account->uid == $node->uid));
}

I'm not a coding expert and don't really understand what's going on with this function. I've given my test user the 'access all webform results' permission, but this function is still returning false. Does anyone have any advice about where to start with this patch?

Thanks!

Comments

mthomas’s picture

The problem was that webform_results_access calls node_access directly, view_unpublished doesn't override the access callback. I put a patch up over here: http://drupal.org/node/1096256