admin管理员组文章数量:1317742
I am creating a WordPress site in which I want to create mini-sites/sub-sites meaning each of them has their own separate user base. Alternatively, it's ok that all the users are in the same base, but that users that are not in the same role, group or those connected to a subsite are hidden. This could be done either with a plugin or that I create a PHP function.
I have looked through many plugins. WordPress multisite have a shared user base. My PHP skills are very limited, but I can understand it when I read it and modify simple things. I saw that it's possible to add_action('pre_user_query','xxxx');
I've tried the plugin "Members". However, if identifying the user's role through $current_user->roles[0]
and I don't know how to create a code that hides users that do not have the same role.
TL;DR
Can anyone suggest a plugin or a PHP function that allows to either have separate user bases for subsites in one WordPress installation or which allows to hide users of another role or connected to another subsite when using the plugin Multisite? I'm also open to hear other solutions that I may not have thought about.
Thank you!!
I am creating a WordPress site in which I want to create mini-sites/sub-sites meaning each of them has their own separate user base. Alternatively, it's ok that all the users are in the same base, but that users that are not in the same role, group or those connected to a subsite are hidden. This could be done either with a plugin or that I create a PHP function.
I have looked through many plugins. WordPress multisite have a shared user base. My PHP skills are very limited, but I can understand it when I read it and modify simple things. I saw that it's possible to add_action('pre_user_query','xxxx');
I've tried the plugin "Members". However, if identifying the user's role through $current_user->roles[0]
and I don't know how to create a code that hides users that do not have the same role.
TL;DR
Can anyone suggest a plugin or a PHP function that allows to either have separate user bases for subsites in one WordPress installation or which allows to hide users of another role or connected to another subsite when using the plugin Multisite? I'm also open to hear other solutions that I may not have thought about.
Thank you!!
Share Improve this question edited Nov 2, 2020 at 15:09 Johansson 15.4k11 gold badges43 silver badges79 bronze badges asked Nov 2, 2020 at 13:04 jl001jl001 1 6 | Show 1 more comment1 Answer
Reset to default 0You can use a subdomain for every site. Then it's easy to separate the users per wp-config.php
:
$base = str_replace( '.', '_', filter_input( INPUT_SERVER, , 'SERVER_NAME' );
const CUSTOM_USER_TABLE $base . '_users';
const CUSTOM_USER_META_TABLE . '_usermeta';
unset($base); // clean up
本文标签: Separate user bases or hide users of another role or connected to another minisite
版权声明:本文标题:Separate user bases or hide users of another role or connected to another minisite 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742020040a2414450.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
https://example/wp-json/wp/v2/users/
you'll see a user list too (although many security plugins disable this for unauthenticated access) – Rup Commented Nov 2, 2020 at 13:27