Let modify the draft SID to be presented for editing even for anonymous (hook_webform_draft_alter)

Created on 6 March 2016, almost 9 years ago
Updated 31 August 2023, over 1 year ago

Dear All, I'm working in a project for anonymous draft submissions based on an authcode by $_GET: https://www.drupal.org/project/webform_draft_authlink any feedback is welcome!

The webform module does not allow to alter the SID in hook_webform_draft_alter for anonymous users and I think it is a good feature to have.

Checking code this are the lines affected:

// Check if this user has a draft for this webform.
  $resume_draft = FALSE;
  if (($node->webform['allow_draft'] || $node->webform['auto_save']) && $user->uid != 0) {
    // Draft found - display form with draft data for further editing.
    if ($draft_sid = _webform_fetch_draft_sid($node->nid, $user->uid)) {
      ...
    }
  }

to Removing the $uid != 0 protection as this part of code only calls _webform_fetch_draft_sid where it will be handled

// Check if this user has a draft for this webform.
  $resume_draft = FALSE;
  if (($node->webform['allow_draft'] || $node->webform['auto_save'])) {
    ...
    }
  }

In the _webform_fetch_draft_sid only query database with uid != 0 but call the hook_webform_draft_alter in any case

Feature request
Status

Needs work

Version

4.0

Component

Code

Created by

🇪🇸Spain GeduR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024