Hi:

I really like the Contact List module but want to use cleaner URLs. For example, let's say that I'm using Drupal for the Atlanta Web Entrepeneurs group (which is what we plan to do) and one of my categories is "Programs Committee." That would produce the following URL:

   http://www.atlanta-web.org/contact/Programs+Committee

Doing only simple manipulation of the category name i.e. strtolower(str_replace(" ","-",$category)) we could have this, which is better:

   http://www.atlanta-web.org/contact/programs-committee

We could also provide an option to use the first word lowercased (which would work for me but I'm not sure how generally applicable it would be):

   http://www.atlanta-web.org/contact/programs

Which brings me to preferring that the user gets to manually enter the URL "slug" (providing in my case the same URL as the previous example):

   http://www.atlanta-web.org/contact/programs

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

-Mike Schinkel

Comments

behindthepage’s picture

Sounds like a good idea Mike. I would love to have your input. As you have said it is not that hard to do.

Check out your other request as I have more info there.

Regards
gpdinoz

mikeschinkel’s picture

Cool. Here's a link for others who in the future may want to follow our discussions.

mikeschinkel’s picture

Hi gpdinoz: I'm working on implementing the clean URL and can get it working and also get an option field to show up on the admin form, but I can't get it to save. I've looked at all your code and cannot see how you persist your values. Do I need to create some kind of hook in contact_list.module or even in contact.module? Thanks in advance.

behindthepage’s picture

Any form names(?) in hook_admin_settings will be saved (automatically) in the variables table. The way I do it is by altering the contact module settings form [which is defined in contact_admin_settings() in the contact module] with hook_form_alter function.

This altering is done in contact_list_form_alter() [or contact_forms_form_alter()]

function contact_forms_form_alter($form_id, &$form) {
  if ($form_id == 'contact_admin_settings') {
    Change the form
  }
}

I hope this sheds some light on it.
Regards Geoff

mikeschinkel’s picture

@gpdinoz: Any form names(?) in hook_admin_settings will be saved (automatically) in the variables table.

Strange. I modified contact_forms_form_alter() to include a checkbox field and used variable_get() and it worked on the form but it didn't persist the information.

I'll look at it some more...

behindthepage’s picture

Cleaner URLs have been implemented in the latest release. Thanks for your input Mike.

mikeschinkel’s picture

Thanks. Sorry I had to jump onto other projects and didn't follow up. Can I blame my clients for changing my focus? :-)

behindthepage’s picture

Sure you can, without clients we would have no problems at all.

behindthepage’s picture

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

Transfered from Contact List