By arosboro on
I keep track of a session variable, $_SESSION['school'] on my webpage that stores the school of the visitor. I would like to load this into a webform as a hidden value using the %session[school] token.When I added a hidden field with the token as the default value, and looked at the html of the form the hidden value is empty.
I also tried using the markup field type to use PHP directly, but any php code for example echo "hello world."; does not show anything. I had selected php as the input format.
Am I doing something wrong? The user is anonymous, does this affect the webform tokens?
Please help. Thanks.
Comments
Fixed
I found a solution to allow tracking of session variables for anonymous users. This is Webform 6.x-3.4.
around line 2531 of webform.module there is a line like this:
change $allow_anonymous to TRUE and everything will work. You should not use caching if you do this, as sensitive information about users could be cached in your webforms.
Functionality
This has to be the default functionality of webform module, because I don't imagine a security risk...tell me if im wrong?
Same problem with %server
Shouldn't this be handled by permissions and at least documented somewhere?
Is there a patch to allow anonymous or an override I can do for a specific form?
I'm not familiar with the
I'm not familiar with the process of patching webform. Maybe you could write a feature request and a patch will be created.
It's work ! Great job !
It's work ! Great job !
It will be beter to do this in the webform admin panel ...
agreed
this should be included in the UI, with a suitable disclaimer about the session variables being cached in webform.
See #605572: %server variable
See #605572: %server variable no more accessible by anonymous users in the webform module issue queue.