drupal user login redirect

∥☆過路亽.° 提交于 2020-01-14 19:15:31

问题


hi i wrote a module for user page generation. After login the path goes to users/[user-name] and i want to customize it using my module. how to handle it?


回答1:


You can use Login Toboggan to set a login destination. There are a few modules available for login redirecting without having to code.

To customize the look and feel of the user profile page, you can implement that through a TPL with CSS, or you can use Views to create Content Panes in conjunction with Panels, and override the user/% profile view.




回答2:


With hook_form_alter you can create a submit handler for the login form, and in it set $form_state['redirect'] to where you want the user to be redirected to when the user logs in.




回答3:


You can implement a hook_user fonction like this

function mymodule_user($op, &$edit, &$account, $category=NULL) {
 switch ($op) {
  case 'login':  // user just logs in...
                        // Modify $_REQUEST['destination'];
                        // but no drupal_goto in order 
                        // to avoid problem with other hook
   break;
 }
}

More here : http://www.youtube.com/watch?v=UoeFTr124jw




回答4:


Yes, you can do this and much more with Login Toboggan, but if you just want to redirect where users are taken to after logging in try the module Login Destination: (D6 & D7)



来源:https://stackoverflow.com/questions/3003983/drupal-user-login-redirect

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