Hi, my question is: since i'd like to make a facebook ads campaign for affiliates for my product, i'd like to track my conversions, so i'd like to redirect the signup form for affiliates to a custom thank you page. I tried to implement a plugin, but i have problems, because the brick works, but there is no redirection, after signup, the user goes straight to the member area. i created a directory called 'tyaffform' and inside i put 2 files: tyaffform.php and brick.php and in tyaffform.php there is: PHP: <?phpclass Am_Plugin_tyaffform extends Am_Plugin{ const PLUGIN_STATUS = self::STATUS_PRODUCTION; const PLUGIN_REVISION = '0.1'; // this will load the custom brick function onLoadBricks(Am_Event $event) { require_once dirname(__FILE__) . '/brick.php'; } function onSignupUserUpdated (Am_Event $event){ $this->store_tyaffpage_url($event->getvars()); } function onSignupAffAdded(Am_Event $event){ // getvars returns all form vars $this->store_tyaffpage_url($event->getvars()); } function store_tyaffpage_url($vars){ if(isset($vars['tyaffpage_url'])){ $_SESSION['tyaffpage_url'] = $vars['tyaffpage_url']; } } // this method will be called before rendering "thanks" page function onThanksPage(Am_Event $event) { $controller = $event->getController(); // ThanksController instance if(isset($_SESSION['tyaffpage_url'])){ // there was an tyaffpage_url in the signup form. Delete it from the session // and forward to the TY page (deleting prevents next purchase from forwarding again to same url) $controller->getResponse()->setRedirect($_SESSION['tyaffpage_url']); unset($_SESSION['tyaffpage_url']); } }} and in brick.php there is: PHP: <?phpclass Am_Form_Brick_TyAffUrl extends Am_Form_Brick{ protected $hideIfLoggedInPossible = self::HIDE_DONT; public function __construct($id = null, $config = null) { $this->name = ___('Thank Affiliate You Page (Hidden)'); parent::__construct($id, $config); } public function initConfigForm(Am_Form $form) { $form->addText('tyaffpage_url')->setLabel(___('Affiliate Thank You Page URL'."\nUse this to forward user to a thank you page after signup success - ONLY FOR AFFILIATE PAGE")); } public function insertBrick(HTML_QuickForm2_Container $form) { $form->addHidden('tyaffpage_url')->setValue($this->getConfig('tyaffpage_url')); }}?> what am i doing wrong? thanks for the help regards Guido
I solved in this way: I modified the file: application/aff/controllers/SignupController.php (at the end of the method called 'process') adding these lines of code: //$this->_redirect('aff/aff'); if(!$this->getDi()->config->get('ty_aff_page_url')) $this->_redirect('aff/aff'); else $this->_redirect($this->getDi()->config->get('ty_aff_page_url')); return true; and modified the file: /application/aff/library/SetupForms.php (at the end of the method called 'initElements') adding this line of code: $fs->addText('ty_aff_page_url')->setLabel(___('Thank You Page Url')); regards Guido