Contact Forms - Unique Path and Form for each Contact Category
Overview
http://drupal.org/project/contact_forms
This module expands the features of the site wide contact form. It eliminates the need for the drop down category menu by generating a form, and a unique path, for each of the contact form categories.
The path 'contact/{category}' generates a contact form for that category with a title = 'contact {category}'.
If a path is entered that does not have a category you can specify a page to redirect to. The default fall back path is contact.
Usage
This module was written for sites that have many email contacts where you want a page with information about the people / departments etc with links to their individual contact forms.
Create a "Contact Directory" page with a path like 'directory' and lay it out how you would like it. Links to the forms can be made with the following code [using the drupal link function]
<?php
print l('Email Jill Jones', 'contact/Jill_Jones');
?>This page can be set as the fall back page if a contact/category path is entered that doesn't exist.
Requirements
contact.module must be enabled.
Installation
- Copy contact_lists folder to sites/all/modules/.
- Check contact.module is enabled
- Enable Contact Forms module
Upgrading
If you are upgrading from an older version of Contact Lists, disable and uninstall the old version then delete the contact_list folder before you upload and enable the new version.
Snippets
1. The "old" contact/list page
This will give you a list of links to the contact forms.
<!-- start snippet -->
<p>Who would you like to contact?</p>
<?php
$result = db_query('SELECT * FROM {contact} ORDER BY weight, category');
print '<div id="contact-list">';
print '<div class="item-list"><ul>';
while ($contact = db_fetch_object($result)) {
$cleanurl = str_replace(' ', '_' ,$contact->category);
print '<li>'. l($contact->category , 'contact/'. $cleanurl) .'</li>';
}
print '</div>';
print '</div>';
?>
<!-- end snippet -->Credits
Thanks to the following people who have helped with suggestions and code:
nancyw
alienbrain
incrn8
joachim
mfredrickson
jandd
Tips
- You can change the message 'You can send %category a message using the contact form below.' on the contact form settings page.
- CSS to hide the bullets on the contact/list page
#contact-list li {list-style: none ;}
Can use contact form for multiple purposes
Find out how here.
Geshan
My Blog
Installation
"1. Copy contact_lists folder to sites/all/modules/"
I cannot locate a "contact_lists" folder, assuming this is now the "contact_forms" folder?