如果他们登录后,如果他们属于某个角色,如何将用户重定向到特定页面? [英] How to redirect user to a specific page after they login if they belong to a certain role?
问题描述
您可以在Drupal中定义操作和触发器:
Action( admin / settings / actions )
- 重定向到特定页面
触发器( admin / build / trigger / user )
- 用户登录后
尝试这个。
编辑(见评论):
创建一个小模块来检查用户的登录处理他所拥有的角色,然后如果需要重新定向。
drupal_goto => drupal中的redirect-function
hook_user =>触发用户操作
对于用户的角色:
GLOBAL $ user;
$ roles = $ user-> roles;
$ vendor = in_array('vendor',$ roles);
$ vendor然后持有真/假值将决定是否重定向。
如果你不知道如何做到这一点,只要在这里发布,我会为你写的模块。但这可能是为您编写未来的drupa模块的好习惯。 :)
We have certain users in our member list that have a role "vendor" attached to them. All such members are to be redirected to a certain page upon login. How can this be accomplished?
You can define actions and triggers in Drupal:
Action(admin/settings/actions) - Redirect to a specific page
Trigger (admin/build/trigger/user) - After user has logged in
Try this.
EDIT (see comments):
Create a small module to check on a user's login process what role he has and then redirect if neccesary. drupal_goto => redirect-function in drupal
hook_user =>triggers on user operations
And for the user's roles:
GLOBAL $user;
$roles = $user->roles;
$vendor = in_array('vendor', $roles);
$vendor then holds a true/false value will decide to redirect or not.
If you don't know how to do this, just post here and I'll write the module for you. But this would be a good practice for writing future drupa modules for you perhaps. :)
这篇关于如果他们登录后,如果他们属于某个角色,如何将用户重定向到特定页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!