Skip Navigation

[Resolved] Create search page for CPT that distinguishes between Members & Public viewers

This support ticket is created 4 years, 4 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: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Michael 4 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#1909045

We have created a collection of 'directory' pages based on various themes for a CPT named Resources. Some Resources are 'members only' which is indicated by a custom checkbox associated with Resources - we want to hide these from public view (ie only seen by logged-in users).

I have been able to create a page with 2 conditional containers (intended to differentiate between logged-in and not-logged in users) using similar views where the only difference is that one view presents the 'members only' Resources and one doesn't ... so far, so good.

I would expect the Members Only view to use the following condition:

NOT (
Current user role is empty .
)

while the Public view presented to users with an Empty role.

When I set both views to NOT Empty so that I can see if the views are functioning properly while working on the site then we have a page that shows both views/searches correctly at the same time.

Once I change the condition for the public search to 'Current Role is Empty' the page fails to render correctly:

- if the view with 'Current Role is Empty' condition comes first then the page presents in a confused nested fashion that starts with several repetitions of the page title and then seems to nest one view inside the other

- if the 'Empty' conditions comes second then it still shows both views

I worked through the Membership Site lessons but did not see this scenario directly addressed there. This is currently being developed on a staging site so I can't supply a link here but can provide access to the site if that helps?

#1910117
member-condition.png
guest-condition.png

Hi,

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

I've performed some tests on my website by using the "Current User ID" ( instead of the User Role ) and it worked as expected.
( please refer to the attached screenshots )

Can you please test the same on your website and in case the issue still persists, you're welcome to share temporary admin login details, in reply to this message.
( along with the link to the page where these conditional blocks and views can be seen )

Note: Your next reply will be private and lease make a complete backup copy, before sharing the access details.

regards,
Waqar

#1912119

Thank you for sharing these details.

While, I can see the issue with the conditional blocks on your website, I couldn't reproduce this on a test website.

This suggests that something specific to your website's set up is involved. To troubleshoot this, I'll suggest the following steps:

1. Please make sure that WordPress, active theme and all plugins are updated to the latest versions.

2. It would be interesting to test this with all non-Toolset plugins disabled and a default theme like Twenty Twenty-One.

If it's fixed, you can start adding the disabled items, one-by-one, to narrow down to a possible conflicting one.

3. In case the issue still persists, I'll need a clone/snapshot of the website, to investigate this in more depth on my own server.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

Please let me know how it goes and I've set your next reply as private.

#1913995

Thank you for sharing these files.

Unfortunately, I tried to deploy this package, but it keeps showing a number of errors.

The staging website no longer seems to be accessible, but, if you could share temporary admin login details of the live website, I'll be able to create and download a duplicator package directly, excluding the unnecessary files.

I've set your next reply as private again and for future reference, you can use any file sharing service including OneDrive, to share the duplicator package files.

#1917127

Just wanted to let you know that I've managed to successfully deploy your website's clone on my server.

I'm currently performing some troubleshooting and will share my findings as soon as it completes.

Thank you for your patience.

#1917685

Thank you for waiting.

During troubleshooting, I noticed that the test page "ScratchPage" on this new staging website is set up differently than the one you shared earlier and its layout is also not breaking the same way.

I also tested some conditional blocks on the clone that I have on my server and the new staging website that you've shared but couldn't make the conditional blocks behave inconsistently.

Can you please check the test page "Test Page from Waqar" that I've created on your staging website with different conditional blocks?

#1918651

My apologies regarding the ever-changing staging site - was using it to troubleshoot/test more than this issue.

I have looked at you Test Page on the current staging site and it seems to be working now as expected - but what does that tell us about the previous trouble? Was this an issue with Toolset? Was this an issue with my hosting?

Unfortunately I was under considerable pressure to move on and have already put a 3rd party plugin in place to address the issue with conditionals. Obviously I would rather keep this all within the Toolset environment but as I don't understand what the issue has been I had to make a decision.

I would be happy to hear any further insight you might have but otherwise I think we can close this discussion down - am sure you have plenty of other people to help.

Thanks for taking the time to help - I am grateful.

#1918655

My issue is resolved now. Thank you!