By jg314 on
There are a number of changes I would like to make to the personal contact form, but I don't know how. Can anyone point me in the right direction?
Thank you.
There are a number of changes I would like to make to the personal contact form, but I don't know how. Can anyone point me in the right direction?
Thank you.
Comments
D6: Contact form is built by:
D6:
Contact form is built by: http://api.drupal.org/api/drupal/modules--contact--contact.pages.inc/fun...
You can alter it using: http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo... (or
hook_form_alter(), not much difference in most cases)Example:
Note that you can also leave the default user contact form intact and alter a copy (mapped by
hook_forms()) instead.@Drave, sorry I should have
@Drave, sorry I should have mentioned that I'm working in Drupal 7. Do you know where I can find the form there?
Thanks for the help.
This, I reckon:
This, I reckon: http://api.drupal.org/api/drupal/modules--contact--contact.pages.inc/fun...
to modify contact form
you can add text and css like this : http://bri-space.com/content/theming-contact-form-drupal-7-contactsiteform
Diana Castillo
Awesome @Drave, thanks so
Awesome @Drave, thanks so much for pointing me in the right direction. Now I can't seem to get the hook to work correctly.
I am calling the following code:
When I look at the $form array through the dvm call I don't see any of the form elements there and the to element still appears. When I tried to use hook_form_alter instead of hook_form_FORM_ID_alter I got the same result.
What am I missing here?
Function arguments?
Function arguments?
hook_form_FORM_ID_alter(&$form, &$form_state, $form_id)You have
&$formtwice there.@Drave, haha, wow. Thanks.
@Drave, haha, wow. Thanks. Talk about glancing over a glaring mistake.
I appreciate the help throughout.
Since it makes sense that
Since it makes sense that those who edit the form would also want to edit the email that is sent out I figured I would post my code for that as well. Here is the implementation of hook_mail_alter I used for the drupal 7 user contact form.
where do you put this code?
I found it easier to modify it in template.php as described here http://bri-space.com/content/theming-contact-form-drupal-7-contactsiteform
Diana Castillo
How to change just the title?
By default the personal contact form is setting the title using the API Contact Personal Form:
How would I go about changing the title to use the Real Name of the person if we are using the module Real Name?
I'm guessing I will need to create a custom module and use a hook? I don't know how or where to begin doing this.
Create a module, implement
Create a module, implement hook_form_alter() and use drupal_set_title() to set the title you want.
Contact me to contract me for D7 -> D10/11 migrations.