Our Website is only for registered users.
For this we are using toolset access.
I only recently was aware that the search result from relevanssi are visible anyway.
I searched the forum and found the following articles but I had no success in getting the result of the relevanssi from being displayed.
https://toolset.com/forums/topic/relevanssi-allows-users-to-see-other-users-private-posts/
https://toolset.com/forums/topic/remove-relevanssi-results-from-front-end/
I thought initially that my view for the search result (layout-for-person-archive) is being controlled by access.
You can check the current behavior at
hidden link
I also was looking at relevanssi for some code (functions.php)
but had no luck in getting it to work.
hidden link
hidden link
I thought initially that my view for the search result (layout-for-person-archive) is being controlled by access.
Hello, as you may have read one of your other ticket links, Access does not filter the output of Views so the post type settings and applied post groups have no effect on the results shown in a View. With that being said, I might be able to help you hide posts in the search results from Guest users if you can provide a bit more information by answering the following questions:
- Do you want all posts of all types and all post groups hidden from Guest Users in search results pages, or are there some specific posts or specific post types that should remain searchable when logged-out?
- Some of the links you provided mention "protected" posts, also referred to as posts published privately in WordPress. This built-in WordPress feature makes each private post visible only to the logged-in post author and logged-in site administrators. Are some or all posts on your site published privately? Should this private setting have any impact on the search results seen by Guest Users?
- Can you show me the details of the Layout and WordPress Archives assigned to Search Results? Please take screenshots in wp-admin so I can see the Layout cells responsible for this page. Please also take screenshots of the WordPress Archive cell contents so I can review your setup.
If you would prefer to allow access to your wp-admin area, I will be glad to take a closer look for myself. Please provide login credentials in the private reply fields here. I will review your setup and give you some feedback.
Okay it seems that this WordPress Archive is responsible for the design of the search results page:
hidden link
I have added some Toolset Access control shortcodes that will prevent content from being displayed to Guests. The syntax is:
[toolset_access role="Guest" operator="deny"]Guests will never see this text.[/toolset_access]
The new code from the updated loop editor is shown here:
[toolset_access role="Guest" operator="deny"]<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-4">Es gibt <h8>[wpv-found-count]</h8> Einträge mit diesen Kriterien</div>
<div class="col-sm-4"></div>
</div>[/toolset_access]
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop wrap="4" pad="true">
[wpv-item index=1]
[toolset_access role="Guest" operator="deny"]<div class="row ">
<div class="col-sm-3">[wpv-post-body view_template="WordPress Archive - Schleifen-Objekt"]</div>[/toolset_access]
[wpv-item index=other]
[toolset_access role="Guest" operator="deny"]<div class="col-sm-3">[wpv-post-body view_template="WordPress Archive - Schleifen-Objekt"]</div>[/toolset_access]
[wpv-item index=4]
[toolset_access role="Guest" operator="deny"]<div class="col-sm-3">[wpv-post-body view_template="WordPress Archive - Schleifen-Objekt"]</div>
</div>[/toolset_access]
[wpv-item index=pad]
[toolset_access role="Guest" operator="deny"]<div class="col-sm-3"></div>[/toolset_access]
[wpv-item index=pad-last]
[toolset_access role="Guest" operator="deny"]<div class="col-sm-3"></div>
</div>[/toolset_access]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]Leider nichts gefunden![/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
I also noticed there was a missing closing div tag in the pad-last item, so I replaced it. The code highlighter will show this closing div tag as an error, but it is actually required here. You can disregard the red highlight. Now guests see no search results, as shown in the attachment. If you would like to add a message, you can edit the WordPress Archive and place your message text somewhere outside the wpv-loop tags. Use the Access button above the Loop Editor to create Access Control shortcodes which will allow you to display text only to Guest Users.
Wow, thank you for your brilliant solution. Many thanks for your help!