By nikan on
In D6 we could configure a webform field to pull profile data by using a token like %profile[key] and assigning the user field to the form [details here]. How can we to something similar in D7, using the user fields instead of the profile fields?
Comments
No one? Why? Is it a dumb
No one? Why? Is it a dumb question or nobody knows the answer?
no this is not a dumb
no this is not a dumb question I need to know how to do this too.
Not dumb
I am also working on figuring this out as well.... thought maybe %profile was changed to %user, but that didn't work either.
Webform tokens for user fields not working?
I encounter the same problem. I tried % user as well but without success.
My solution tested and works for Drupal 7.15 and Webform 7.x-3.1
You must replace the foreach line in 3042 webform.module per this new foreach.
Youssef El Montaser
This works but gives you error messages
You need to replace:
with
Thanks!
Ugh still nothing....
Ugh still nothing....
Ugh still nothing....
Ugh still nothing....
I also have the same problem
I have google it, and D7 have another profile module then D6.
And when you create user field in D7 they starts with field_ instead of profile_ :-(
Some one who has a solution to use tokens in D7, I´m working with a webform and wants to get the user adres as a default value from the logged in user, like %profil[field_adres1]
Use the Token module
I have read you can use the Token module to do this, but unfortunately this doesn't work for me. The syntax for the form fields default value should be something like [user:field_adres1].. Let me know if this works for any of you guys..
Need to fix webform.module
I ran into same problems. It seems no one has found an answer yet, so I went to take a look at the source.
I added few lines to fix the problem. I haven't tested so many times, but it seems working so far.
I added webform.module on line 2854:
I hope this helps those who faces the same problem.
Thanks you very much, that
Thanks you very much, that works for me ! :-)
To get user profile fields in
To get user profile fields in webform token, add this:
file: webform.module
function: There _webform_filter_values()
In line: 2962 ( 7.x-3.x-dev 2012-Apr-16 )
search for:
replace with:
Now You can put any profile fields as default value in forms :)
By doing his, you mess up the
By doing his, you mess up the $account object, which cannot be used properly by other modules.
Prefer this :
Made the change to the
Made the change to the module. But how do I use the profile fields?
Ok, I switched to the alpha
Ok, I switched to the alpha version that has the token support. Then all I have to do is go to the user settings page where it has the available tokens, copy it, and put it into the default value. Wish the token list showed on the webform, but this isn't too bad.
if you use it like this, it
if you use it like this, it will support multiply default values separated by commas
the tokens can used like this:
%profile[field_user_last_name] where field_user_last_name is the name of the field
Works
echatiaig's code works for me. Thanks. Let's hope they add it to the next release.
Add entity title to token
Thanks for sharing this code.
I add a test and a node_load to add entity ref value.
It's awfull but it does the tricks...
Dave Reid implemented the D7
Dave Reid implemented the D7 token system for webform in the 7x-4x branch. Please use the 4x branch of webform for access to proper user tokens. Note that when upgrading from webform 3x to 4x, various database updates are needed, so don't forget to run /update.php.
@see #1001798: Rewrite token replacement system to use D7 tokens
Hawkeye Tenderwolf
a Senior Developer
at Lullabot