سؤال

I have been trying to redirect to a page/route of my choice after zfcuser registration. Currently it redirects to the login page.

I was able to make changes on the init event where I am now using the recaptcha instead of figlet.

I have added a listener on my module's bootstrap method on zfcuser's register event. But not sure what to do afterwards so that I can redirect to a page of my choice after user registers. Any help would be much appreciated as it would also help me alot on my basic understanding of zf2.

Here is my bootstrap code (nothing much there) on my module class on zfcuser register event:

$zfcServiceEvents = $e->getApplication()->getServiceManager()->get('zfcuser_user_service')->getEventManager();
$zfcServiceEvents->attach('register', function($e) use ($app) {

// ...............

});
هل كانت مفيدة؟

المحلول

You will have to return a Response-Object from that listener. Whenever there is a return Object of type Response, then the application workflow stops and the Response is returned.

What you wanna be doing is to create said Response-Object, give it the status redirect and add the header for redirection ;)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top