Skip Navigation

[Resolved] [Access] Custom 404 page

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user was unable to choose a content template for restricted users in Toolset Access settings.

Solution:
It turns out that the user has an active WPML Access Group that already has a setting to use the default 404 page instead of a content template.

This support ticket is created 3 years, 5 months 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: Africa/Casablanca (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by hugoC-3 3 years, 5 months ago.

Assisted by: Jamal.

Author
Posts
#1844185
Schermafbeelding 2020-11-14 om 10.32.46.png
Schermafbeelding 2020-11-14 om 10.28.27.png

Tell us what you are trying to do?
I try to set up Access in a way that when visiting a page with restricted access the non logged in user sees a content template or page template. But all I get is this (see screenshot). How can I get a decent 404 page to work?

Is there any documentation that you are following?
https://toolset.com/course-lesson/setting-access-control/

#1844405

Jamal
Supporter

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

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

Hello and thank you for contacting the Toolset support.

According to your Access settings, the option is not activated for Guest users(non logged in users). Check this screenshot hidden link

I hope this helps. Let me know if you have any questions.

#1845767
4 restrict access.png
3 postgroups2.png
2 postgroups1.png
1 cpt.png

I don't really get it.

1. I set cpt "dagboekberichten" to be invisible to guest and pending roles.
2. I set the post group "community logged in" to use a 404 content template for users without read permission
3. When I click preview link I get "No posts for preview"
4. When I click "post groups > modify group" it looks like I need to select each individual post to restrict access.

What I need is that access to each post of the type Dagboekbericht is automatically restricted to logged in users, without having to select them one by one.

How can I achieve this?

#1846145

Jamal
Supporter

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

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

Post groups are used to restrict access to selected posts. That's not what you would like to have.

According to your first screenshot (Schermafbeelding 2020-11-14 om 10.32.46.png) the post type should not be accessible to non logged in users and users with the "Pending" role.

I run a test on a clean install and as you can see on the following urls, non logged in users are unable to access the posts:
- hidden link
- hidden link

Now if you login with the following URL, they will be accessible hidden link

If this is not working for your custom post type, please allow me temporary access to check this closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

It would be better if you can prepare a staging site, this way, I can run tests such as disabling plugins or switching themes.

#1846377

Jamal
Supporter

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

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

The Access control settings were not restricting guest users hidden link

But even after disabling read access to guests, we still get the same error page.

I suspect that another component(theme or plugin) of the website is interfering with Toolset. Please check if this issue appears when:
- Only Toolset plugins are activated. It will tell us if there is an interaction issue with another plugin.
- The theme is set to a WordPress default like Twenty Fourteen. It will tell us if there is an interaction issue with your theme.
If the problem disappears, start activating one at a time to track where the incompatibility is produced.

If we don't find the conflicting component, we'll need to take a copy of your website for further debugging locally. Let me know if you would agree.

#1847251

With my theme activated I get an non-styled 404 page like you could see in the screenshots. I will get in touch with my theme developer to investigate this.

I have tested with the default WP theme and got a decent 404 page like you had in your sandbox.
I also disabled all plugins except Toolset and WPML, but this gave me the 404 page only, even though I had set up Access to use a content template (I created a template called 404 for this purpose).

So at first sight I don't find any theme or plugin conflicts. Please have a closer look at the issue. Since we are on a staging site with a daily backup you can freely activate and deactivate plugins etc.

Thank you!

#1847387

Jamal
Supporter

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

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

Once we deactivate WPML, Access uses the content template 404. But when using WPML it does not. This was expected as you have an active WPML Group in Access on this custom post type. Check this screenshot hidden link
It is configured to display the default error page.

After setting the content template for this Access Group, the 404 content template is correctly used. Check this screenshot hidden link

I hope this helps. Let me know if you have any questions.

#1847783

My issue is resolved now. Thanks a lot!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.