| Joomla! http://forum.joomla.org/ |
|
| Guide:: How to REDIRECT after Submit Contact-form! http://forum.joomla.org/viewtopic.php?f=483&t=35582 |
Page 1 of 1 |
| Author: | leolam [ Sat Feb 04, 2006 5:05 pm ] |
| Post subject: | Guide:: How to REDIRECT after Submit Contact-form! |
Many questions have been asked on how to redirect to a Thank-You page after submitting a contact-us form from the contact component. The current implementation of the Thank you message above the submitted form is a jerk and not very profesional. Here is how to solve this, compliments of JooMaDesk!
now find on or around line 450 - 452 (in v1.0.10) this code: Quote: $link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='. $contact[0]->id .'&Itemid='. $Itemid ); mosRedirect( $link, _THANK_MESSAGE ); replace that code with the URL for the contact Thank-you page as defined as follows: Quote: mosRedirect( 'http://www.yoursite.com/index.php?option=com_content&task=view&id=15&Itemid=44' ) Indeed you see it correct...the first line has been deleted and if you look sharp (you have to!) you also see Quote: ' ' at the beginning and the end. Do not forget those!If you have SEF enabled and have some nice URL's defined or have something like (example) http://www.yoursite.com/content/view/15/44/ than put that SEF-based URL into the code... That's all folks.......This works like a charm on our site......Send us a mail and see for yourself! ![]() Luck Leo edited: updated to version 1.0.10 code in contact.php |
|
| Author: | FluidDruid23 [ Tue Apr 25, 2006 6:07 pm ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Hi! I found this topic, as I need to put a nice redirect in when users send a comment. Problem is, I can't find this code in contact.php. I am using Joomla 1.08. Matt FluidDruid23 EDIT: Found it, sorry. Was being a jerk...
|
|
| Author: | SteveWR [ Fri May 12, 2006 11:18 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Great that works but what about the [back] option at the foot of the new Thank You static page. Just an extra tweak remember to go into the new static thank you page, go to parameters, and Hide the back button, otherwise when someone clicks they go back to the form they have just completed and sent. Maybe the code on contact.php can be changed so that [back] goes to home page, but that is extra work ... |
|
| Author: | phlux0r [ Wed Sep 13, 2006 12:41 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
This post inspired me to extend the hack to be more user friendly. Hardcoding the new Thank You page link directly in the contact.php file doesn't really leave much room for customising things... so I decided to simply add a couple of parameters to the contacts component menu item. This way, the admin can specify whether there should be a Thank You page and if so, the link to it. This solution will preserve the default functionality and add the Thank You page redirect via configuration. This is what you need to do (hack performed and tested with a 1.0.11 Joomla installation): 1. Edit /administrator/components/com_contact/contact.xml and add the following lines to the end of the Code: <param name="@spacer" type="spacer" default="" label="" description="" /> <param name="thankYouPage" type="radio" default="0" label="Thank You Page" description="Separate Thank You Page"> <option value="0">No</option> <option value="1">Yes</option> </param> <param name="thankYouURL" type="text" default="" label="Thank You Page URL" size="40" description="The Thank You page to display" /> 2. Edit /components/com_contact/contact.php and find the line that says: Code: $link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='. $contact[0]->id .'&Itemid='. $Itemid ); 3. Insert immediately after that line the following code: Code: // content thank you page redirect hack - begin code - $thankMessage = _THANK_MESSAGE; $thankyou = $mparams->get( 'thankYouPage', 0 ); if ( $thankyou ) { $thankyouURL = $mparams->get( 'thankYouURL', '' ); if ( $thankyouURL ) { // if something has been entered in the URL field we use that otherwise use the link set up above $link = sefRelToAbs ( $thankyouURL ); $thankMessage = ''; } } // content thank you page redirect hack - end code - 4. Replace the line: Code: mosRedirect( $link, _THANK_MESSAGE ); with: Code: mosRedirect( $link, $thankMessage ); 5. Create your Thank You page as a static content item as per first post and find out the link 6. Go to the Contact Us menu item in your menu and you should see the extra parameters at the bottom of the parameter list. Check the Yes radio button for the Thank You Page and enter the thank you page link in the box. Save the changes and you should be all set. The code will automatically convert the link you pasted into SEF so no need to adapt it. Enjoy |
|
| Author: | leolam [ Fri Sep 15, 2006 3:24 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
COOL! and thanks.....(should have been an option in "core" anyhow! imho) cheers Leo |
|
| Author: | Rwin [ Wed Sep 20, 2006 12:01 pm ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Have tried this solution but no go. ![]() I get the 'default' message from the langfile. ![]() I altered the files as described, made a static page, made the menu item to fetch the link and pasted the link into 'Thank You Page URL' field. What am I doing wrong?? Does it have anything to do with having multiple ways/links to the contact information and its forms?? |
|
| Author: | phlux0r [ Wed Sep 20, 2006 12:36 pm ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Did you tick the "Yes" radio button for the Thank You Page when you pasted the URL in the field below? Of course you have to save your edits. |
|
| Author: | Rwin [ Thu Sep 21, 2006 7:56 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Yes, I did. :-) (forgot to mention that) Any other ideas? |
|
| Author: | phlux0r [ Thu Sep 21, 2006 9:00 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Are you certain that your edits of the file: /components/com_contact/contact.php are in fact in place on the server you are trying this on? Just double check that the code is in the actual file on the server. If that is OK, then all I can suggest is to retrace every step carefully and check if everything is the way that it's described since it works fine for me .
|
|
| Author: | Rwin [ Thu Sep 21, 2006 12:59 pm ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Thanks for your fast replies! :) This piece of code was copied directly from the file contact.php that is on my server: Code: ............. $success = mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $email, $copy_subject, $copy_text ); if (!$success) { mosErrorAlert( _CONTACT_FORM_NC ); } } $link = sefRelToAbs( 'index.php?option=com_contact&task=view&contact_id='. $contact[0]->id .'&Itemid='. $Itemid ); // content thank you page redirect hack - begin code - $thankMessage = _THANK_MESSAGE; $thankyou = $mparams->get( 'thankYouPage', 0 ); if ( $thankyou ) { $thankyouURL = $mparams->get( 'thankYouURL', '' ); if ( $thankyouURL ) { // if something has been entered in the URL field we use that otherwise use the link set up above $link = sefRelToAbs ( $thankyouURL ); $thankMessage = ''; } } // content thank you page redirect hack - end code - mosRedirect( $link, $thankMessage ); } } function vCard( $id ) { global $database; .............. I thought I did that correct. Since I can tick the Yes or No radiobutton and was able to put an url into the "Thank You Page URL" field I figured that the xml file is correct to. |
|
| Author: | Rwin [ Thu Sep 21, 2006 1:22 pm ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! [SOLVED] |
Ahum, ![]() I had this different approache to my contacts. I made a "Table - Contact Category" menu-item which displays a table of all contacts. I also placed it in the topmenu, which isn't the problem since I just checked that. Why I made a different menu item linking to "Table - Contact Category" I don't know.Just now, I found out that all these parameters are in the contact component. Works like a charme now!!! Thanks for your time and lovely hack ofcourse.
|
|
| Author: | rberthelette [ Thu Mar 08, 2007 11:20 pm ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
This is what I'm talking about! Quality posts! Works like a champ! It would be nice to have this redirect built-in as a redirect URL in the Contacts module. Cheers, Ray |
|
| Author: | curvesahead [ Wed May 09, 2007 2:54 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
These are great directions! It worked for me and I am a novice at this!! Thanks for the great documentation!! |
|
| Author: | snadowitz [ Tue Sep 25, 2007 8:00 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
many thanks for this great work |
|
| Author: | harooon [ Thu Oct 04, 2007 4:55 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
great ideas ! |
|
| Author: | birkenstam [ Mon Oct 08, 2007 9:53 am ] |
| Post subject: | Re: Guide:: How to REDIRECT after Submit Contact-form! |
Thx for that. is it possible to make this to work in ' Link - Static Content ' ? as it now works with ' Component - Contacts ' if it works with ' Link - Static Content ' then is possible to make other thank you pages with other forms. i hope you understand my question. Warm regards Birken |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|