You are here

function hook_webform_results_access in Webform 7.4

Same name and namespace in other branches
  1. 6.3 webform.api.php \hook_webform_results_access()
  2. 7.3 webform.api.php \hook_webform_results_access()

Determine if a user has access to see the results of a webform.

Note in addition to the view access to the results granted here, the $account must also have view access to the Webform node in order to see results. Access via this hook is in addition (adds permission) to the standard webform access.

Parameters

$node: The Webform node to check access on.

$account: The user account to check access on.

Return value

bool TRUE or FALSE if the user can access the webform results.

See also

webform_results_access()

Related topics

1 invocation of hook_webform_results_access()
webform_results_access in ./webform.module
Menu access callback. Ensure a user both access and node 'view' permission.

File

./webform.api.php, line 670
Sample hooks demonstrating usage in Webform.

Code

function hook_webform_results_access($node, $account) {

  // Let editors view results of unpublished webforms.
  if ($node->status == 0 && in_array('editor', $account->roles)) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}