How do I create a webform for each user?
In my website, each user with the manager role needs a webform to get enquiries from users.. the webform which have created is for co开发者_StackOverflow中文版mplete website.
How do I do this?
It sounds like you should use the contact module in core drupal rather than a webform. You can turn it on, and configure permissions so that every manager can be contacted through that form.
If you need additional fields than what the contact form comes with, then a little work with hook_form_alter() should allow you to add additional fields.
Unless part of the requirements is to keep a record of each contact sent?
If you are not set on using Webform module, this could be a more complex, but suitable method for doing what you require.
- Set up a custom content type with the fields you require for your form with CCK
- Use a User Reference field to indicate which site user the form should be sent to
- NodeReference URL could help in automatically populating the forms if you use Content Profile as well. Unfortunately there doesn't seem to be a 'UserReference URL' module.
- PrePopulate will allow you to set the form's values from a link using GET parameters, though the links aren't as clean as NodeReference URL's method.
- Use Actions to send a message to the user specified on the from when it is submitted
It may be helpful to create a View which will list for each user the forms they have been sent, so that they can easily find them from one location.
You probably also want to set up a content access module so that not everybody can view the submitted forms. You will have to find one that suits your needs, but you should be able to set the content type to only be viewable by its recipient (and author, if necessary) or by certain roles (eg., all managers can see all requests)
Use contact Module: The Contact module allows site visitors to send emails to other authenticated users and to the site administrator. Through personal contact forms, users can send one another an e-mail. And through site-wide contact forms, users can send e-mail to arbitrary email addresses, such as the site maintainers.
References: https://www.drupal.org/docs/8/core/modules/contact/overview
精彩评论