Solving Drupal site contact problems with contact forms
Time and again I've faced a problem of creating multiple contact forms but with use of the contact module there is only once contact form accessible at site-URL/contact. But now the problem can be solved with use of Contact Forms module, you can download the module here.
With Contact Forms module installed you can create multiple categories of contact forms and on top of it you can also send the subject for the contact e-mail as a URL parameter which opens up new possibilities in contact. I'll show one usage I did using this module with a contact for booking.
Steps to follow to do this:
With Contact Forms module installed you can create multiple categories of contact forms and on top of it you can also send the subject for the contact e-mail as a URL parameter which opens up new possibilities in contact. I'll show one usage I did using this module with a contact for booking.
Simple Usage
Assuming that you are familiar with Drupal module installation and simple usage I'm writing the things below. Follow theses steps to use contact forms for separate things like contact us, contact advertising for now:- Download the module here, and install it to your Drupal site.
- Activate the module from Modules page from Admin settings. (You will need admin rights to do this)
- Then go to Administer>>Contact Form to get a page like below and click "Add Category":
- Fill details and click submit:
- Then you can access the contact form at site-url/contact/us.
- Try contact/us/For advertising and see a result like below:
- Make other categories as per need and use them accordingly. Like you can make different contact forms for marketing, contact, webmaster etc.
Creative Use: with theme tweak
Now lets use a contact form called booking for booking trips/hotels or anything. Main thing is the node title should be passed via the URL and some text + Node title should appear in the subject. For ex: subject should be like Booking For: ABC hotel where ABC hotel is the node title.Steps to follow to do this:
- Make a different contact category/form called booking accessible at site-URL/contact/booking and make sure anonymous users have access to this module check administrator>>User>>Access control
- Tweak your node-type.tpl.php file, like if its a trip page then make trip.tpl.php and edit it as below:
Change:
To:
Get the code. - Then check out your node page like if its your booking page check that out, to see something like:
- On link click you might see something like:
- You have done it congrats.
Drupal will change the world :-), keep Drupalling..