in Hacks, Joomla

Joomla 1.5 hack Contact component form redirect

When it somes to Joomla 1.5, sometimes having to create a feedback form is overkill, when all you really need is for a Contact to do a graceful redirect to a thank you page upon submission.

This hack requires modifying a core component, so be sure to save a copy of your original 🙂

The file to edit is:
/components/com_contact/controller.php

Create your redirect page and have the URL for the redirect handy.

Look for the following code at line 193 in Joomla 1.5.10 (this is the version I was working on this week):

$msg = JText::_( 'Thank you for your e-mail');
$link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact->slug.'&catid='.$contact->catslug, false);
$this->setRedirect($link, $msg);

And replace it with this code:

$link = JRoute::_('redirect url goes here');
$this->setRedirect($link);

Replace the text redirect url goes here with the URL of your redirect page. Save and upload the revised controller.php file.

Thanks to Sulu for showing the way.