I'm getting this warning in both the admin and anon visitor view for any webforms I create:

Notice: Undefined property: stdClass::$wpd_valid in webform_protected_downloads_form_alter() (line 876 of xxxxxxxxxxxx/httpdocs/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).

Comments

berliner’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Status: Active » Fixed

Ah, I see, you configured node types other than the default webform node type to be wenform enabled, right? My module didn't cope with this up to now. I fixed this now in the dev version.

ClaudeS-1’s picture

Status: Fixed » Active

I got this error again with the May 14th dev build - different line number now

Notice: Undefined property: stdClass::$wpd_valid in webform_protected_downloads_form_alter() (line 866 of xxxxx/httpdocs/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module).

berliner’s picture

Status: Active » Postponed (maintainer needs more info)

Can you give me more information about the context? This time I can't reproduce the warnings.

ClaudeS-1’s picture

Nothing especially helpful. A "Product" content-type node was being edited, lots of fields filled, and the notice appeared when the form was submitted. On returning to the page, all the fields were empty.

However, "Product" isn't a webform-enabled content type. Perhaps some invalid check is letting your module code be called on content-types where it shouldn't be called?

berliner’s picture

hm, that sounds strange and not particularly easy to reproduce. The warning is generated inside the following confition in hook_form_alter:

if (strpos($form_id, 'webform_') !== FALSE) {
}

So I would suppose that it triggers only for webform forms. Honestly I have no idea why it should trigger for non-webform forms.

Do you feel like debugging this a bit by any chance? Would be helpful to solve this issue. Like e.g. checking the value of $form_id in the given scenario to see where it comes from.

ClaudeS-1’s picture

I added a debug line and found these values in $form_id:

comment_node_product_form_form_id: search_block_form_form_id: webform_client_form_93

The last one is the culprit, it's a simple Webform contact form displayed in a block in the footer of the page.

I enabled webform for Basic Page, made a contact form, and displayed it as a block. There are no protected downloads configured for the form.

berliner’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for digging into this. With those information I was able to fix the issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

qsurti’s picture

I am getting the same problem:
"Notice: Undefined property: stdClass::$wpd_valid in webform_protected_downloads_form_alter() (line 876 of /home/diamonds/public_html/d/sites/all/modules/webform_protected_downloads/webform_protected_downloads.module)."

I am using Webform Protected Download ver 7.x-1.0-alpha1. The Notice appears when I edit ubercart Product node.

If I edit the webform and add few new fields, would the data be saved and will the program function properly or should I wait till this issue is fixed?