You are here

function webform_submission_edit in Webform 5

Editable display of a webform submission.

1 call to webform_submission_edit()
webform_results in ./webform.module
Menu callback for all content under admin/content/webform.

File

./webform.module, line 1988

Code

function webform_submission_edit(&$node, $sid) {
  include_once drupal_get_path('module', 'webform') . "/webform.inc";
  $node->webformcomponents = _webform_components_decode($node->webformcomponents);
  $submission = _webform_fetch_submission($sid, $node->nid);
  if ($sid && is_numeric($sid)) {
    if (user_access("edit webform submissions") || user_access("edit own webform submissions") && $user->uid == $submission['uid']) {
      drupal_set_title(t('Submission #@sid', array(
        '@sid' => $sid,
      )));
      $node->body = "";
      return drupal_get_form('webform_client_form_' . $node->nid, $node, $submission, TRUE);
    }
    else {
      watchdog('webform', t('Unauthorized webform access attempt by %name.', array(
        '%name' => $user->name,
      )), WATCHDOG_WARNING);

      // and log the attempt
      return drupal_access_denied();
    }
  }
}