Skip Navigation

[Resolved] How to use post groups efficiently?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by himanshuS 1 month ago.

Assigned support staff: Jamal.

Author
Posts
#2168409

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.

#2168839

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

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.

#2169093

Thanks, Jamal.

Can you please also answer my first question?

#2171741

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

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?

#2172223

My issue is resolved now. Thank you!