0

I want to be able to have a contact form that lets visitors send email to different users (like a staff directory) without exposing the email address or user id. I am going to come up with my own way of identifying users to not expose Drupal specific information. Anyway.

However, I need to:

  • Pass that value in the URL to identify the user to locate, to know where to send the mail

  • Load and check the user from that passed value before showing the form

  • If the user is not a certain role, serve a 404 instead of a form (only certain roles can be contacted).

  • Preferably have a url like /staff/{FOO}/contact where {FOO} is my custom value.

Would it be easier to just implement this myself, or rely on Webform? I wanted to take advantage of Webform in case the client wanted to add another field later or create other forms (more basic ones), throttle repeat submissions and the dozens of other things Webform can do.

2
  • I think there needs to be a webform_contact.module which mirrors how the contact.module adds a contact form to every user profile.
    – jrockowitz
    Commented Apr 17, 2018 at 15:09
  • All custom module Vs custom webform integrated module. As far as "what is easier" depends on your Drupal 8 knowledge.
    – No Sssweat
    Commented Apr 17, 2018 at 15:41

1 Answer 1

0
  • Pass that value in the URL to identify the user to locate, to know where to send the mail

  • Load and check the user from that passed value before showing the form

  • If the user is not a certain role, serve a 404 instead of a form (only certain roles can be contacted).

  • Preferably have a url like /staff/{FOO}/contact where {FOO} is my custom value.

If you want to make a webform integrated module, you can achieve all of the above by altering certain webform's route(s) & maybe service(s).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.