Support » Plugin: Relevanssi - A Better Search » Search Bug/Conflict with Restrict Content Pro Plugin

  • Resolved livingmiracles

    (@livingmiracles)


    Hello,

    Our site is using the Restrict Content Pro plugin in conjunction with Relevanssi to deliver good search results for subscribers. However, when we set up the site originally, it was showing search results using the post excerpts to non-members also and the set up was the same; Restrict Content Pro and Relevanssi.

    Some months ago we noticed that the searches were not resulting in any posts showing up anymore if we were not logged into the site. The only posts that we see showing up in search results when not logged in are two posts that in their Restrict Content Pro settings are set to be visible to “Everyone.” All the other posts are restricted via Restrict Content Pro to anyone with the “Subscriber” role only.

    We tested the search functionality using the term “happiness.” Here are our results (Restrict Content Pro was kept enabled for each test):

    • Relevanssi Active, User Logged Out: Only 1 search result which is one of the posts that in its Restrict Content Pro settings is set to be visible to “Everyone.” See this screenshot.
    • Relevanssi Active, User Logged In: Many posts with the search term are shown as expected/desired, including the subscriber-only content (videos). See this screenshot.
    • Relevanssi Deactivated, User Logged Out: Many posts with the search term are shown as expected/desired, excluding the subscriber-only content (videos), which is what it should be. See this screenshot.
    • Relevanssi Deactivated, User Logged In: Many posts with the search term are shown as expected/desired, including the subscriber-only content (videos). See this screenshot.

    Is there some kind of new conflict between Relevanssi and Restrict Content Pro? If so, can this be resolved and would there be an ETA for when it gets implemented in an update?

    Thank you!
    Nicolas from Living Miracles

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    What Relevanssi does hasn’t changed much. Relevanssi asks RCP whether the user can access the post and includes the post in the results only if RCP says it’s ok. That’s what Relevanssi has done before, that hasn’t changed.

    Relevanssi uses rcp_user_can_access() to check whether user is allowed to access the post or not. I think the problem here is that RCP says “no, the user can’t access this” for all the subscriber-only content, and thus Relevanssi does what it’s told to do and doesn’t show the content.

    So Relevanssi is working as it should, but it sounds like you don’t want Relevanssi to the filter protected content at all. Add this to your theme functions.php:

    add_action( 'init', function() { remove_filter( 'relevanssi_post_ok', 'relevanssi_restrictcontentpro_compatibility' ); }, 11 );

    This will remove the Relevanssi RCP filtering completely. Now all content – including subscriber-only content – will be shown to all users in the search.

    Thread Starter livingmiracles

    (@livingmiracles)

    Hi Mikko,

    Thank you for the response. It isn’t quite what we’re asking. We actually don’t want the subscriber-only content to be shown to visitors that aren’t logged in. We want just the excerpts to be visible and searchable to visitors that aren’t logged in. Relevanssi used to do this but we’re not exactly clear when this stopped working.

    Are you able to provide a solution so that excerpts are searchable again to visitors that aren’t logged in?

    Thank you,
    Nicolas from Living Miracles

    Plugin Author Mikko Saari

    (@msaari)

    Just follow the instructions I gave, because it is exactly what you’re asking for. I’m only talking about Relevanssi and the search here: if you remove the RCP filtering in Relevanssi, you’ll get the results you want.

    When Relevanssi doesn’t do any RCP filtering for the results, people who aren’t logged in will see the restricted content in the search. RCP will still stop them from seeing the actual content; Relevanssi RCP filtering has nothing to do with that.

    Thread Starter livingmiracles

    (@livingmiracles)

    Hi Mikko,

    Thanks for clarifying. We tried out the code in our functions.php file and it indeed worked for us.

    Thank you,
    Nicolas from Living Miracles

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Search Bug/Conflict with Restrict Content Pro Plugin’ is closed to new replies.