I have created a standard Site Wide contact Form.

The default h1 title of this form is 'Contact.'

But I want to change it to 'Contact ABC Media' instead.

So, I copied the file contact.module from modules/contact and put it in my themes>mysitename.

Then on line 93 of contact.module, where it says: 'title' => 'Contact',
I changed it to 'title' => 'Contact ABC Media'

I saved and went to administer/themes/save configuration and
I also did administer/performance/clear cached data

Finally, I hit refresh on my web browser (firefox) and then clicked on the Contact primary link.
But the title for my contact form remains the same: 'Contact'

Please help. How can I accomplish this?
Thanks :)

Comments

bookwalla’s picture

Okay, so instead of copying contact.module file and placing it in my themes/mysite folder, and then editing line 93.

I simple edited contact.module in its default location (module>contact>contact.module), changed line 93 to: 'title' => 'Contact ABC Media'

Saved and refreshed and WALLA! IT WORKS!

SO, is this the correct way to go about this is Drupal 6.17?

yelvington’s picture

No, absolutely not. See:
http://www.flickr.com/photos/hagengraf/2802915470/
and
http://drupal.org/node/77487 (old but still true)

Strings are run through the t() function so that they can be rewritten.

Install http://drupal.org/project/stringoverrides

mahnster’s picture

I am looking for a solution to this too and I downloaded "stringoverrides" (http://drupal.org/project/stringoverrides) as you recommended, but I realized that if I put the orig string to be "Contact" and the new string to be "Contact ABC Company", won't it change ALL strings with "Contact" in it to have that new string?

My only other solution is in the theme's page.tpl.php file, near the top, put this in the HTML before the $title is printed:

  if( $title == "Contact" ){
    $title = "Contact ABC Company";
  }
mahnster’s picture

I know one also could also copy the theme's page.tpl.php to page-contact.tpl.php and change the Title, but I find that to be bad in case I need to make layout changes that I would also want to take place on that page.

bookwalla’s picture

I tried this module: http://drupal.org/project/stringoverrides. And it works.

But I decided to disabled the module. Cleared the cache. But I still see the text I used to replace the default 'Contact' text.

Now that the module is disabled, saved configuration. The string i used (Contact Abc Designs) to replace 'contact' should be removed as well. But it is not???

bookwalla’s picture

anyone, please?

bookwalla’s picture

Okay, I resolved the problem. I enabled the module once again. And then in the module undid the changes I had made. A very simple problem.

Thanks for your patience :)

danielmai’s picture

Hi bookwalla!

You can change the contact page title by modifying the translation of "Contact" to whatever you like.

I just used it in pt-br translation.

Hope it helps =)

doomed’s picture

Hello,

I'm having a weird problem..

I can't translate the Contact Form title. It always says "Contact Us" and i cant find the correct string on Interface translation.

Any help is appreciated.

I'm using the Locale module, i am not using Internationalization. I am not using Content translation module.

boran’s picture

I'd locale and i8ln enabled, but could find a "Contact" in the translation search that points to the contact module.
However, Contact was visible for another module, and my translating that the Contact form title was effectively translated.

Note that the strings are care sensitive when you search.

fnikola’s picture

How do you change the contact page title? I am not using the menu item (it is disabled in the navigation menu) and only link to that page from a custom block. I have a different block for each language, but they all link to the same /contact page that only displays the English "Contact Us" page title. I do not see the page title in the i18n translation search and have tried using string overrides for "Contact Us" in the appropriate language without success.

drupal_pupil’s picture

open settings.php

search for * Variable overrides:

paste this code above that section (make sure you are not inside a php comment tag /* */)

 $conf = array(
   'contact_form_title' => 'Send a Message to Mr Monkey',
   );

! NOTE: If you put any single quote apostrophes in that value, make sure you use a leading backslash \ to escape them , i.e. Contact Drupal\'s Webmaster

save file

go into module file /modules/contact/contact.module
near line 92, or search for $items['contact']
change to show as below:

  $items['contact'] = array(
    'title' => variable_get('contact_form_title','Contact'),

save file

clear performance cache /?q=admin/settings/performance, scroll to bottom, click "Clear Cached Data" button

now you should see the value you set in settings.php

I put it in settings.php because if you run a multisite installation, you can set the value to be different for mulitple sites.

but this is so retarded I'm going to go find the module and hack an update for it. I can't believe it has been this way for so long. :(

Tor Arne Thune’s picture

In Drupal 7 (and probably Drupal 6) you can modify the title bar text and page title by adding this code to the template.php file of your theme (remembering to change 'mytheme' to the name of your theme):

/**
 * Implementation of hook_form_FORM_ID_alter()
 */
function mytheme_form_contact_site_form_alter(&$form, &$form_state) {
  drupal_set_title('Contact ABC Media');
}

Never hack core files, as this will make it a headache to troubleshoot and upgrade your site.

makangus’s picture

hook_form_FORM_ID_alter() is probably the best solution

Andrew Schulman’s picture

In D6, the function should be named hook_form_contact_mail_page_alter(), where you replace hook by the name of your module or theme.

pillarsdotnet’s picture

Good. — Fast. — Cheap.
(Pick any two.)

annie2512’s picture

To change the Contact form default title, just go into Navigation menu and change the menu link title 'Contact' to whatever to want. Do this even though you may not be using the Navigation menu or the menu item is disabled. Once that is done, whichever menu has your Contact form, you will see the form has the new title.

jshimota01’s picture

wow. looked all over for that tidbit. thanks!

Anonymous’s picture

Three years down the line and this still works a like a charm!

Many many thanks for making life easier for us all. Have been trying all sorts of stuff and then your advice did the trick.

quicktrick’s picture

I could not edit the Contact form default title and its translation in Drupal 8.  The "Edit menu link Contact" form (admin/structure/menu/link/contact.site_page/edit) says:

"This link is provided by the Contact module. The title and path cannot be edited."

I could not find a translation string for the Contact module title in the "User interface translation" (admin/config/regional/translate) either.

How can I change the translation for the menu link Contact?