문제

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