Forums

redirect url from code

sjellum 05 Jun, 2009
I would like to redirect to an error page if a credit card fails verification. I am using the following code in the On submit - before sending email section.

<?php
global $cf_AUTHNET_response_code;
if ($cf_AUTHNET_response_code != 'Approved') {
$emails[0]->enabled = 0;
$mainframe->redirect('http://www.colvinrunpto.org/content/view/153/153');
}

?>

This produces the error:
Fatal error: Call to undefined method mosMainFrame::redirect() ...

Any ideas why redirect is undefined?
Thanks, Sue
GreyHead 06 Jun, 2009
Hi Sue,

Which Joomla version is this? I though that all the 'mos' references were removed from Joomla 1.5.

Try adding $mainframe to the global declaration
global $cf_AUTHNET_response_code, $mainframe;

Bob
sjellum 06 Jun, 2009
Hi Bob, thanks for replying.

We are using Joomla 1.0, ChronoForms 2.3.9. If I declare $mainframe, I get:

Fatal error: Call to undefined method mosMainFrame::redirect() in /home/crptou/public_html/components/com_chronocontact/chronocontact.php(401) : eval()'d code on line 7


if it is not declared, I get:

Fatal error: Call to a member function redirect() on a non-object in /home/crptou/public_html/components/com_chronocontact/chronocontact.php(401) : eval()'d code on line 6

Thanks,
sue
GreyHead 06 Jun, 2009
Hi Sue,

OK - I just checked and I think that the Joomla 1.0 command is
mosRedirect('http://www.colvinrunpto.org/content/view/153/153');
(no global declaration required). And you can try using
$error_found = true;
to stop the emails and data saving.

Bob

PS Just noticing that it's getting more and more difficult to dredge up the old Joomla 1.0 code from the memory cells.
sjellum 06 Jun, 2009
Woot! Works great - thanks so much!
This topic is locked and no more replies can be posted.