• On my site (www.thedanceattic.com), I am using a plugin (Role Scoper) to limit access to certain post categories unless you are logged in to my site. I would like these same categories to be excluded from the search results if you are not logged in. For example if you search on “Rehearsal” you should not find very many posts however you find all of them. If you click on the first post, you are unable to open it due to the security however the excerpt gave you most of the post.

    This functionality worked using the default WP search engine however I prefer the Relevanssi functionality. Is there a way to filter these category results when the user is not logged in?

    Also, I am having an issue getting the date relevance filter to work. I put the code in the functions.php file and re-indexed but it doe not sort as I expected.

    function date_weights($match) {
    $post_date = strtotime(get_the_time(“Y-m-d”, $match->doc));
    if (time() – $post_date < 60*60*24*7) {
    $match->weight = $match->weight * 2;
    }
    else {
    $match->weight = $match->weight / 2;
    }
    return $match;
    }
    add_filter(‘relevanssi_match’, ‘date_weights’);

    Thanks,
    Mark

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

    (@msaari)

    Relevanssi supports Role Scoper and for private posts checks if the user has “read_post” rights for the current post. I did this for someone’s request, I don’t use Role Scoper myself, so I don’t know anything else about it.

    The date filter doesn’t work, because the ‘relevanssi_match’ filter is a Premium feature.

    Hello,
    In fact, I’m also using Role Scoper and Relevanssi and I have a problem, too.

    If a user finds any word in my blog (a user who only can access to some categories), all related contents are displayed, even if the user hasn’t rights to do it, but if the user tries to follow the link of one of these posts to read the whole text, log in is required (due to Role Scoper functions).

    So, I would like to limit the search only for the suitable categories in each case, depending on the user who is logged.

    Is it possible?

    Thank you very much,

    Plugin Author Mikko Saari

    (@msaari)

    Someone with more experience on Role Scoper should probably rewrite the Role Scoper interface code in Relevanssi in the relevanssi_default_post_ok() function to worry about categories as well. I don’t know how Role Scoper works, and don’t have time to learn it just to fix this one thing.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘{Plugin Relevanssi] – Filter Posts’ is closed to new replies.