简体   繁体   English

强制将用户重定向到相应的子站点(wordpress多站点)

[英]force redirect users to respective sub-site (wordpress multi-site)

So does anyone know how to implement code that checks if users are a member of the site and if not, redirect them to their respective sub-site? 那么,有谁知道如何实现代码来检查用户是否是该站点的成员,如果不是,则将其重定向到各自的子站点? Essentially, I am trying to restrict logged in users to the sub-site they are registered in, so when they try to access the main site or a different sub-site, they get redirected to their sub-site homepage. 本质上,我试图将登录用户限制为他们在其注册的子站点,因此当他们尝试访问主站点或其他子站点时,他们将被重定向到其子站点主页。

There are lots of Wordpress plugins that allow you to do this sort of thing. 有许多Wordpress插件可让您执行此类操作。

I would recommend 'Multisite User Management' . 我建议使用“多站点用户管理” You will then simply need to apply a specific user role to each site, and edit the user role verification code to redirect users as appropriate. 然后,您仅需要将特定的用户角色应用于每个站点,并编辑用户角色验证代码以适当地重定向用户。

If this doesn't help, I would advise searching for 'User Roles' and 'Multisite User Management' in the Wordpress plugin search. 如果这没有帮助,我建议在Wordpress插件搜索中搜索“用户角色”“多站点用户管理” There is a wealth to choose from and at least one of them should do most of what you need. 有很多财富可供选择,其中至少有一个应该满足您的大部分需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM