I have 4 logged-in user roles and a logged-out user role. This is what I want to accomplish -
1)There are some pages only logged-in users should access. Logged out users should be redirected to the home page
2) There are some pages on 'employer' user type should access. Others should be redirected to their specific page.
3) Point (2) is true for other user types too.
My questions are
1) Should I create a user group for "logged-in" users and then create a separate group from "employers or should I create 4 different post groups for 4 types of users? Will there be a conflict if the same user is in two groups?
2) How does redirection work with toolset post groups? I don't want the user to see a 404 page.
Hello and thank you for contacting Toolset support.
Toolset Access does not offer a way to customize the redirection. It only offers to generate the error page or to display a content template. You can use the content template to display a redirect message and perform a redirection using Javascript.
Otherwise, you will need to hook earlier before the page starts loading and programmatically decide what redirect to use. You can use the template_redirect action and check the user, the post, and decide if it should be redirected to its specific page, or ignore and let Toolset handles the other cases.
https://developer.wordpress.org/reference/hooks/template_redirect/
I hope this helps. Let me know if you have any questions.
Thanks, Jamal.
Can you please also answer my first question?
My apologies for missing that question. Because Toolset does not offer a way to customize the redirection, there is no other solution than custom code to have working redirections.
Be it for the logged-in group, or other post groups, you will need custom code to have your desired redirections. Does it make sense?
My issue is resolved now. Thank you!