Drupal - After each user login, how can I redirect

2019-08-04 10:30发布

问题:

What we need: redirect to each user's specific page after their login.

What we have tried:

Login Toboggan module: can be direct to each user's profile page, however we do not where to define specific node, i.e node 15 for user David. If you have experience on this, please advise.

Nodeacccess: generic access control defined to each content type.

Any other suggestions?

回答1:

I'd recommed the Login Destination module. You can use PHP to set specific nodes to redirect to per user. The documentation on that page is pretty clear, but in case you need some more help, your PHP snippet will end up looking something like:

global $user;
switch $user->uid {
  case '1': //for user 1
    return 'node/1'; //to redirect to node #1
  case '2': //for user 2
    return 'node/10'; //to redirect to node #10
  // and so on...
}

Hope that helps!

EDIT: Just found this, might be helpful.



回答2:

Nah, triggered rules have this built in.

Select condition when user logs in, select action direct user to page, done.



回答3:

Try using Login Destination Module.



标签: drupal