Skip Navigation

[Resolved] Relevanssi allows users to see other users private posts

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

Problem:
Relevanssi has some problems when it comes to checking if it can show private posts to a user, if the post is in a custom post type.

Relevanssi doesn’t actually check the what the capability to read private posts is called, but instead assumes it’s read_private_slugs, where slug is the name of the post type.

Solution:
https://www.relevanssi.com/knowledge-base/private-posts-custom-post-types/

This support ticket is created 6 years, 9 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 16 replies, has 3 voices.

Last updated by rayG-2 6 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#631376

We cannot assist custom code debugging.
https://toolset.com/toolset-support-policy/

To craft custom code you need to either have the knowledge to do so or contact a Contractor, for example, which can help with these tasks:
https://toolset.com/contractors/

Here we can only hint, and give suggestions, as Toolset is built with one main purpose in mind:
Avoid custom code.

I understand that sometimes, it's not possible elsehow, but we still can be of limited assistance only, in these cases.

Let me reply to your doubts you expressed above:

1. I get a syntax error, unexpected 'if' (T_IF) in line 6. I am using the Snippets plugin for extra code.

This is due to a missing ";" at the end of your code line:

    $cpt_slug = 'job-application' // Edit as required 

2. I still see results from other users, when I am logged in as a customer or subscriber.
I am using a standard WP search widget inserted into the footer, so as not to add another layer of confusion.

Can you explain how this issue is related to Toolset?
The only search feature Toolset offers is in Toolset Views Custom Searches.
Those can be enhanced using Relevannsi, but only what relates to "where to search". Not "what is displayed".

In Views, or WordPress Archives created with Views, this fully depends on:
- conditionals in HTML
- Query settings
- Access Rules
- Post settings

Note that for example in a View, you may see posts that are private, if not excluded or specified otherwise in the View.
Or, you may see posts the user should not read as set in Toolset Access.
Toolset Access rules, for example, do not affect Views lists.

But, as far I understand this, you use neither Views nor archives styled with Views, but Relevannsi and inbuilt WordPress Core features.

What you see would not depend on where the Post or Fields are created (Toolset, probably), but on the plugins, you use to build the search.

The code as well seems not related to Toolset.
I suggest to contact the Support of the related plugin.

#631662

I apologise if my question has crossed a line.

I am having difficulty grasping some of the concepts within Toolset and WordPress, but your response has cleared up one of them, in so far as I need a custom search to filter out user responses. I thought (incorrectly) that the code would do that, this is what I had trouble getting my head around.

I will play with the custom searches and see what I can come up with.
Ray