1

I have created a module that is listening to the customer registration event 'customer_login'. This event is dispatched after the customer has registered on the site and the site is revving up to redirect them to the customer dashboard.

My module is then logging the customer out and setting a success message:

Mage::getSingleton('core/session')->addSuccess('Thank you for registering with %s. Your account needs to be activated by an administrator.', Mage::app()->getStore()->getFrontendName());

When the site then redirects the dashboard, it checks if the customer is logged in (false) so redirects the user to the registration form again. What appears to be happening is that the success message above is being cleared in the customer dashboard so not surviving back to the registration page.

How do I get my success message to persist to the second page?

As well as the above, I have also tried customer/session but that did not work either.

2

You can not make message persist after more than one redirection.
One solution here is to use something persisting like session or cookie to set a flag in your current observer customer_login.
With an other observer on controller_action_predispatch_customer_account_login check your flag and here you can set your message with
$_message = $this->__('Thank you for registering with %s. Your account needs to be activated by an administrator.', Mage::app()->getStore()->getFrontendName()); Mage::getSingleton('customer/session')->addSuccess($_message);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.