How to redirect the visitor after the contact page

How to redirect the visitor after the contact page: 


Open Contact.php and go to line 473 - 475 and change the line:

copyraw
$link = ‘index.php?option=com_contact&task=view&contact_id=’. $contact[0]->id .’&Itemid=’. $Itemid; 
mosRedirect( $link, _THANK_MESSAGE ) 
  1.  $link = ‘index.php?option=com_contact&task=view&contact_id=’. $contact[0]->id .’&Itemid=’. $Itemid;  
  2.  mosRedirect( $link, _THANK_MESSAGE )  

replace that code with the URL for the contact Thank-you page as defined as follows:

copyraw
$link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='. $contact[0]->id .'&Itemid='. $Itemid );
mosRedirect( 'index.php?option=com_content&task=view&id=28&Itemid=102' );
  1.  $link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='$contact[0]->id .'&Itemid='$Itemid )
  2.  mosRedirect( 'index.php?option=com_content&task=view&id=28&Itemid=102' )

 

Create thankyou page and menu item for ID, change this in the code to redirect to the item ID - remove menu item

 

 

Ultimately this solved the problem of redirecting the user after they complete the contact form: 

If you were wondering how to get the default contact form in Joomla 1.5 to redirect you to another page after you submit it, or if you wanted to change the default text that is displayed "Thank you for your e-mail" to something else I will explain how in this guide. I cannot be 100% sure this guide will work for people who have certain extensions installed or who have SEO turned on as i have not tried it. 

Step One: 

First if you don't already have a page that you want to redirect to, you will create one within the Joomla 1.5 admin interface and make sure it is published. I have tried the method below with both an article and a contact page, but it should work for most other page redirects as well. 

Step Two: 

Next if you don't already know the URL of the page you want to redirect to, you will create a menu item in the Joomla 1.5 admin interface that points specifically to the redirect page you created in step one and make sure it is published. Now when you visit your page in the frontend you will see the menu item for the page you created. Click on that link to view your page. We are doing this because you need to find out the exact URL of the page you created. Make sure to copy the URL as we will need some of it in step 3. After you copy the URL you may un-publish your menu item that links to the redirect page in the admin interface, but make sure you leave the redirect page published.

Step Three: 

To finish and make it all work requires editing of a single file in the Joomla installation. If you update or reinstall Joomla you will possibly lose this modification and have to apply it again. 

The file that you will be editing is /components/com_contact/controller.php 

You can open it in Dreamweaver or other good editors. 

(Joomla 1.5.2) 
Near lines 193-195 locate: 

Code: 

copyraw
$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);
  1.  $msg = JText::_( 'Thank you for your e-mail')
  2.  $link = JRoute::_('index.php?option=com_contact&view=contact&id='.$contact->slug.'&catid='.$contact->catslug, false)
  3.  $this->setRedirect($link, $msg)

 

Category: Joomla :: Article: 164

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Joes Word Cloud

work   contact   mail   admin   published   thank   tried   publish   frontend   exact   php?option   form   sure   default   guide   file   jroute   step   link   doing   menu   open   item   visit   interface   code   line   find   jtext   copy   editing   change   click   joomla   index   redirect   created   need   locate   again   make   visitor   after   mosredirect   links   create   finish   page   already   view   JoelLipman.Com

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.