Plugin Author
Ajay
(@ajay)
Hi @hassan0a
How are you thinking about this? Limiting the KB to only be visible to a certain set of user roles? I.e. not public?
I haven’t looked into this so far.
Hi @ajay
I need to build an internal KB for the team in a separate subdomain, so I need to limit access to specific user roles. It’ll be for stuff only, not for everyone.
If you don’t have option on it till now, do you have any idea can help for now.
Thanks
Plugin Author
Ajay
(@ajay)
Are you comfortable with writing/including custom code in your theme’s functions.php or better yet a custom plugin?
I’ll need to do a bit of checking, but it’s mainly a custom post type so if not code, you could also use a user role plugin to just set which user roles can have access. e.g. https://en-gb.ww.wp.xz.cn/plugins/user-role-editor/
Any way you want I can handle it, custom code or custom plugin, so I’m waiting for your checking results.
Thanks
Plugin Author
Ajay
(@ajay)
@hassan0a
I decided to ask Claude the best way to do this because I didn’t get a plugin. Are you able to try this gist?
https://gist.github.com/ajaydsouza/d250240fe6578eef301b377e08d4863c
@ajay
I made a fast test and it’s working by redirecting me to the home page, although I wished it would redirect me to the login screen after filling in all the info and login it would redirect me to the same page but if the user role has access so KB so he will see it, if not he will see a page that he doesn’t have access to see this content.
So is there any way to do such scenario.
Plugin Author
Ajay
(@ajay)
@hassan0a
I’m not clear on the above. Where would you want it to direct to, the login screen instead of the homepage?
For that you could use: home_url() . ‘/wp-login.php’
https://gist.github.com/ajaydsouza/d250240fe6578eef301b377e08d4863c#file-wzkb-role-management-php-L77