Skip Navigation

[Resolved] Access control – redirect to login page or specific user registration page

This support ticket is created 5 years ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#1410635
Toolset-dec 15 - login page .png
Toolset-dec 15 - access control read access .png

Tell us what you are trying to do?
1) I am trying to set "display for single-posts when there is no read permission" and "display for archives when there is no read permission" (see image 2)
to Login or user registration page (created via elementor page builder) based on the user custom role - see image 1

Is there any documentation that you are following? access toolset document

Is there a similar example that we can see?
I have multiple page templates created for
1) single page in elementor
2) archive pages created for custom post types, categories via elementor templates
Neither of the templates created via elementor show up in the access control display conditions for read access (see image 2)

What is the link to your site? hidden link

#1411699

Hi,

Thank you for contacting us and I'd be happy to assist.

The option "Show Page template" refers to the page template files which are available in the active theme or the child theme's folder ( ref: https://developer.wordpress.org/themes/template-files-section/page-template-files/ , which is why the dynamic templates created through the Elementor are not showing in the list.

You can alternatively also create a Toolset Content Template from Toolset -> Content Templates and it will show in the list when you'll select "Show Content Template". In that new content template, you can show the login/registration form or any message as needed.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1411861

Hi Waqar -

Thanks for the response on the content template for the single page. I was trying to use the existing elementor page templates if possible, but I guess that is not the option.

Can you also respond to 2nd part of the question in the support ticket i.e. for archive pages (for categories archive & for custom post type archives), how can I redirect to the login and/or user registration page.

Thanks

#1411871

Hi Waqar -

Thanks for the response on the content template for the single page. I was trying to use the existing elementor page templates if possible, but I guess that is not the option.

Can you also respond to 2nd part of the question in the support ticket i.e. for archive pages (for categories archive & for custom post type archives), how can I redirect to the login and/or user registration page.
Note: I already have archives created via elementor for categories and custom post types, that I plan to use for paid customers.

If I have restricted access to specific posts related to custom post types, will they show in search and archives?

Thanks

#1413219

Thanks for writing back.

If you're using an archive template from Elementor then you'll need to consult its documentation or support team to see it offers any feature to restrict access based on user roles. If it doesn't, then you'll need to include some custom code to redirect users to a login page when they reach a particular archive page.

If you're open to using Toolset's own WordPress Archive templates (Toolset -> WordPress Archives), then restricting access to post type archive and taxonomy archive will work differently.

A. Post Type Archive:
For post type archive page, you'll see the option to restrict access while editing the post type access for each user:
https://toolset.com/documentation/user-guides/access-control/setting-access-control/#selecting-error-display-for-archive-pages

Example Screenshot 1: hidden link
Example Screenshot 2: hidden link

Important note: This will not allow you to redirect the user to a different page, but you can create a separate WordPress Archive for users without access and show a specific message to log in or register, as needed.

B. Taxonomy Archive:
There is no option available to set a different WordPress archive template for taxonomy archives, but you can wrap the WordPress archive's output in "toolset_access" shortcode to show the actual content to only allowed user roles and a different message to the ones who are not allowed.
https://toolset.com/documentation/user-guides/access-control/access-control-texts-inside-page-content/

C. Search Archive:
If you're using Toolset WordPress Archive for the search page, then restricted posts won't appear in the search results.

regards,
Waqar

#1419557

I was able to resolve it with Powerpack Elementor plugin which has display conditions restrictions. It addressed my business needs.

Thanks Waqar for your help !