ZfcUser Redirect to page of my choice after Registration

浪尽此生 提交于 2019-12-12 00:38:54

问题


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) {

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

});

回答1:


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 ;)



来源:https://stackoverflow.com/questions/18432994/zfcuser-redirect-to-page-of-my-choice-after-registration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!