Currently, our team has a custom redirect plugin setup on aMember. The plugin is active and we are able to set the url on aMember admin side, however the redirect is not happening. This is our plugin: PHP: <?phpclass Am_Plugin_ThanksRedirect extends Am_Plugin{ function onGridProductInitForm(Am_Event_Grid $event) { $event->getGrid()->getForm()->getAdditionalFieldSet()->addText('_thanks_redirect_url', array('class' => 'el-wide')) ->setLabel(array( ___("After Purchase Redirect User to this URL\ninstead of thanks page") )); } function onGridProductValuesFromForm(Am_Event_Grid $event) { $args = $event->getArgs(); $product = $args[1]; $product->data()->set('thanks_redirect_url', @$args[0]['_thanks_redirect_url']); } function onGridProductValuesToForm(Am_Event_Grid $event) { $args = $event->getArgs(); $product = $args[1]; $args[0]['_thanks_redirect_url'] = $product->data()->get('thanks_redirect_url'); } function onThanksPage(Am_Event $event) { if(!$event->getInvoice()) return; $url = null; foreach ($event->getInvoice()->getProducts() as $pr) if ($url = $pr->data()->get('thanks_redirect_url')) break; $t = new Am_SimpleTemplate(); $t->assign('invoice', $event->getInvoice()); $t->assign('user', $event->getInvoice()->getUser()); $url = $t->render($url); if ($url) $event->getController()->redirectLocation($url); }} Its almost like the onThanksPage event is not being called as it goes to our confirmation page. Is there a problem with out event?
Is there anything that needs to be added in the site.php as well for the onThanksPage event to fire? We have also tried using: PHP: Am_Di::getInstance()->hook->add(Am_Event::THANKS_PAGE, function (Am_Event $event){ /* @var $di Am_Di */ $di = $event->getDi(); /* @var $invoice Invoice */ $invoice = $event->getInvoice(); if(!$invoice) return; $controller = $event->getController(); $url = null; foreach ($event->getInvoice()->getProducts() as $pr) { if ($url = $pr->data()->get('thanks_redirect_url')) { break; } } $t = new Am_SimpleTemplate(); $t->assign('invoice', $event->getInvoice()); $t->assign('user', $event->getInvoice()->getUser()); $url = $t->render($url); if ($url) { Am_Mvc_Response::redirectLocation($url); $event->getController()->redirectLocation($url); } }); As recommended here: https://www.amember.com/docs/How_to_redirect_user_to_different_thanks_page_after_payment
Is there another thank-plugin we need? Our custom plugin is named thanks-plugin, however that is what we named it.
Do you have any issue with current setup? Do you mind to contact us in helpdesk? https://www.amember.com/support We will help to resolve it as soon as possible. Best Regards.