Hi:

Again I love the Contact List module but have a second feature request for Contact List and that is to have the option to have a "meta" category tied to a content type.

For example, imagine you have a Drupal website for a city government where people might need to contact any of the following:

  • Police Department
  • Fire Department
  • Water Department
  • Parks & Recreation
  • Corrections
  • Planning & Development
  • Mayor's Office

The contact list module currently handles this very well. However,...

In my example you have sixteen (16) city councilman/councilwomen that need to allow people to contect them in addition to the above list of departments. And to model these council people with Drupal you might create a content type called "councilperson." On it you might have a contact email address but you don't display that email address on the councilperson's web page to avoid spam. To add each councilperson to the contact list we could modify the Contact List module to provide an option to specify a content type and one of its fields where the email address is stored to be used as a source for contact list categories. That would give us a list like this (ignoring the bullets and numbering, used here to delineate the differences between the two lists):

  • Police Department
  • Fire Department
  • Water Department
  • Parks & Recreation
  • Corrections
  • Planning & Development
  • Mayor's Office
  1. Anne Fauver
  2. C.T. Martin
  3. Carla Smith
  4. Ceasar C. Mitchell
  5. Clair Muller
  6. Cleta Winslow
  7. Felicia A. Moore
  8. H. Lamar Willis
  9. Howard Shook
  10. Ivory Lee Young Jr
  11. Jim Maddox
  12. Joyce Sheperd
  13. Kwanza Hall
  14. Lisa Borders
  15. Mary Norwood
  16. Natalyn Mosby Archibong

(Yes, I stole the list of names from Atlanta.gov.)

I'm adding this as a feature request not to ask you to do it but because I might be making this change for my use and I'd like to know if you'd accept my updates as a new version?

-Mike

Comments

behindthepage’s picture

If I understand correctly your enquiry is all about displaying a page with a list of the departments and then a list of people underneath.

This is how I do that. I enter all those departments and people into the contact category system so they each have a form and then create a page (with a path like 'directory' or 'contacts') and set out the page exactly as I want or in this case as you have specified. Making the links go to 'contact/category'. This can be done with php like this

<?php
print l('Fire Department', 'contact/Fire Department');
?>

(more info http://api.drupal.org/api/function/l/5 )

Then if you then want to redirect to the 'Directory' page change line 39

  if (!$categories_data['cid']) {
      drupal_goto('contact/list'); // Change contact/list to the path you want it to go to eg 'directory'
    }

I have never been completely happy with the contact/list page that my module generates and I have been thinking of putting a user defined path that it falls back to if there is no contact form available then people could design their 'Directory' page exactly how they want it. What do you think?

Regards
gpdinoz

behindthepage’s picture

StatusFileSize
new1.65 KB

Here is a new version of my module that doesn't have a contact/list page but it does have an option to redirect to a user defined page instead of the contact path. I have also tried your clean urls idea with a user defined slug. I ran into problems with all lower case because I use arg(1) to match against the category in the database and it is easy to change the slug back to spaces but how do we know which characters were upper case. You might have a clever idea on how to do this.

In this version I don't hijack the 'contact' path but create a path for each contact form in hook_menu. I have had a few requests for the the standard contact page to be the default page.

Regards
Geoff

behindthepage’s picture

PS if you are having problems opening tgz in windows get Tugzip at http://www.tugzip.com/

mikeschinkel’s picture

@gpdinoz: If I understand correctly your enquiry is all about displaying a page with a list of the departments and then a list of people underneath.

I was actually using that as a hypothetical example. Maybe I should have used my real example.

I am currently using Drupal to create a generic infrastructure to create websites for homebuilders. Each homebuilder will have one or more subdivisions. For each subdivision there will be a different sales office. Subdivisions are modeled as a content type and we call the content type a "community." What I want to be able to do is have the information for a community maintained in the content for each community but have that automatically show up as a list of contacts within a community. What I don't want to have to do is seperately maintain the contact information in both the community content type and in the contact category, I want it to pull from my "community" content type.

@gpdinoz: I have been thinking of putting a user defined path that it falls back to if there is no contact form available then people could design their 'Directory' page exactly how they want it. What do you think?

I don't follow the use case for "if there is no contact form available." Available for what or when?

@gpdinoz: Here is a new version of my module that doesn't have a contact/list page but it does have an option to redirect to a user defined page instead of the contact path. I have also tried your clean urls idea with a user defined slug. I ran into problems with all lower case because I use arg(1) to match against the category in the database and it is easy to change the slug back to spaces but how do we know which characters were upper case. You might have a clever idea on how to do this. In this version I don't hijack the 'contact' path but create a path for each contact form in hook_menu. I have had a few requests for the the standard contact page to be the default page.

Cool. Give me a few days to get to this. My client is breathing down my neck looking for some visible results so I need to get them some before I work on this part of the project.

BTW, I'll be more than happy to implement whatever changes I'm suggesting and contribute back to Contact_List.

pips1’s picture

Hi, just to let you know that I'm using your "contact forms", the modified version of your "contact list" module (i.e. I have installed the tarball from post #2). It works well for me. Do you plan to keep both versions available in parallel, or will you merge the functionality as configurable options? Many thanks for this useful modified version!

behindthepage’s picture

Title: Implement "Meta" Category using a Content Type » New Version - Choose redirect page
StatusFileSize
new2.19 KB

This is the latest version.

behindthepage’s picture

The new version has been committed with and is now an official release

behindthepage’s picture

Project: » Contact Forms
Version: » 5.x-1.7
Status: Active » Closed (fixed)