Page 1 of 2
Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 10th, 2011, 8:13 am
by tasitasi
Hi, I am building a really basic membership site using Wordpress 3.2.1 and s2member (free version for now), and I have everything working great, except, the Relevanssi search plugin.
The problem is, searching member content will be a key way for members to get to member information. But when selecting all the various options in alternative view protection, in the restrictions options settings for s2member, the Relevanssi plugin still displays content that should only been seen when logged in.
I have set the page level restriction in "edit page".
I have tested this logged out.
My theme is the twenty eleven theme.
My question. Is there a snippet out there that can make Relevanssi work like the built in wordpress search, and not display member content unless a member is logged in when searching? Or some other solution?
I hope this is clear. The same problem seems to exist for WP Search 2.0 as well.
I am happy to provide more info, I am new to posting tech questions on forums so please excuse me if the info isnt sufficient!
Thanks
Chris
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 10th, 2011, 12:54 pm
by Cristián Lávaque
https://wordpress.org/extend/plugins/relevanssi/The problem may be related to what Jason explains in this post
viewtopic.php?f=4&t=3087&p=12882#p12882Jason Caldwell wrote:Developers: please make sure that your plugin is using the WP_Query class, and please make sure that your Ajax request follows the WordPress standard of using /admin-ajax.php.
Have you told the Relevanssi developer about this problem you're having with his plugin?
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 10th, 2011, 6:19 pm
by tasitasi
Hi Cristián, thank you for you reply. I did review that post and have just tried this by replacing the file, but no luck unfortunately. The result appears exactly the same as with the original querys.inc php file. I have not let the developer know yet, but I will as s2 member is a popular plugin. For now though I would expect I need a fix. Do you have any other suggestions? Or does anyone else?
I have noticed this problem occurs with wp search as well.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 12th, 2011, 9:59 pm
by tasitasi
Hi again, seems no one has an answer for this. Perhaps someone can let me know of a decent search plugin that works with s2 member then? I need a search plugin that only shows the results of restricted pages if the user is logged in and has permissions for those pages.
Please help!
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 12th, 2011, 10:13 pm
by Cristián Lávaque
What did the developer of Relevanssi tell you about what I mentioned earlier?
viewtopic.php?f=4&t=14398#p30397
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 12th, 2011, 10:30 pm
by tasitasi
I have just emailed the developer now, hopefully they will view this thread.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 13th, 2011, 1:43 am
by tasitasi
Just had an email from the Relevanssi developer. Said with some modification it is possible. Depending on how easy it is s2member support may or may not be included in the next release. Fingers crossed on this one.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 13th, 2011, 4:36 am
by tasitasi
So I got another update from the developer, says s2member will be supported in the next version of Relevanssi. Thanks for the suggestions again Cristián
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 13th, 2011, 12:59 pm
by Cristián Lávaque
That is awesome! Thanks for the update and please tell the developer to contact us if he needs anything.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 14th, 2011, 6:06 am
by msaari
Your documentation was good enough, no need for help. Relevanssi now supports s2member, starting from versions 2.9.8 (free) and 1.5.13 (premium).
For every search result document (or category page), Relevanssi checks using 'is_permitted_by_s2member' whether the current user can see the result and displays or hides them according to that. This is automatic and requires no adjustment of settings or anything, Relevanssi triggers this on if the function is present.
Thanks for good documentation, not every plugin has API documentation as good as this.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 15th, 2011, 2:42 pm
by Cristián Lávaque
Thanks for the kudos and it's great to know that the plugins are now working together fine. Thank you!
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 19th, 2011, 11:23 am
by arthomas
well,
The updated version of Relevansi is not showing any restricted page results now, even though I have set "Alternative View Protection" to NONE.
I want restricted search results to be shown (they are only excerpts)
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 19th, 2011, 11:36 am
by msaari
If you want to adjust the way protected posts are managed, you can write a function that hooks to relevanssi_post_ok hook. Copy (and unhook) the default function and remove the part about s2member, that will make Relevanssi work like it did before.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 19th, 2011, 12:03 pm
by arthomas
msaari wrote:If you want to adjust the way protected posts are managed, you can write a function that hooks to relevanssi_post_ok hook. Copy (and unhook) the default function and remove the part about s2member, that will make Relevanssi work like it did before.
Thanks for the quick reply,
Honestly, I have no clue how to it, I am not that advanced.
But shouldent it comply with the s2member settings? like the default Word Press search?
For now I have deactivated Relevanssi, I want my users to see search results, Just not the full post, Otherwise they would think that we dont have the content they are looking for, because currently it simply returns a "no results found" message.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 19th, 2011, 12:21 pm
by msaari
Well, it does comply - Relevanssi checks whether the user is allowed to see the post and displays it only if the user is allowed to.
I'm currently using is_permitted_by_s2member() to check whether the user should be able to see the post. As far as I can tell that is the only function that does what I need. If there's a function that tells whether the user is allowed to see the excerpt, then please let me know and I can fix it. Now Relevanssi is showing posts if s2member says it should.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 19th, 2011, 12:27 pm
by arthomas
Thanks Msaaari,
Jason, is there such an option?
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 19th, 2011, 10:04 pm
by Cristián Lávaque
msaari wrote:Now Relevanssi is showing posts if s2member says it should.
Does it mean Relevanssi now works depending on the s2Member Alternative Views setting?
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 21st, 2011, 1:18 pm
by msaari
I don't know how to respect the setting, so no, Relevanssi doesn't care about it.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 23rd, 2011, 7:05 pm
by Jason Caldwell
This code sample no longer works with s2Member v110912+.
Please use this one instead:See:
viewtopic.php?f=4&t=14398&p=37266#p37266
Hi there. Thanks for integrating with s2Member. Great to see that!
Here is how I would handle this in your integration, for maximum compatibility with s2Member.
s2Member's Alternative View Protection allows site owners to choose whether they want protected content excerpts seen inside search results and/or feeds. As a plugin developer, you can test the value of the configured option with this global variable:
- Code: Select all
$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"]
Possible values include: all|searches|feeds|searches,feeds
( this value is set immediately, as soon as s2Member is loaded by WordPress )
Here is a code sample that might help to explain things better for you:
- Code: Select all
<?php
$alt_view_protect = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["filter_wp_query"];
$completely_hide_protected_search_results = (strpos($alt_view_protect, "all") !== false || strpos($alt_view_protect, "searches") !== false) : true : false;
if(is_permitted_by_s2member(123))
{
}
else if(!is_permitted_by_s2member(123) && $completely_hide_protected_search_results === false)
{
}
else {
}
?>
* See also, docs here: viewtopic.php?f=40&t=12453&src_doc_v=110815#src_doc_is_permitted_by_s2member%28%29
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 24th, 2011, 12:28 pm
by msaari
Thanks, this is exactly what I need. I'll fix this in the next version.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 27th, 2011, 12:44 pm
by msaari
With the option 2 ("Show title and excerpt."), is showing the results of get_the_excerpt() ok?
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 27th, 2011, 3:58 pm
by Jason Caldwell
Hey.. Thanks for the follow-up.msaari wrote:With the option 2 ("Show title and excerpt."), is showing the results of get_the_excerpt() ok?
Certainly, that would be just fine to do that.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 27th, 2011, 9:30 pm
by msaari
Great. Relevanssi Premium 1.6 now has upgraded s2member support and the free version will have it too in the next release.
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
August 28th, 2011, 2:05 am
by Cristián Lávaque
Great!
Re: Relevanssi version 2.9.7 and s2member version 110731
Posted:
September 4th, 2011, 2:50 pm
by arthomas
msaari wrote:Great. Relevanssi Premium 1.6 now has upgraded s2member support and the free version will have it too in the next release.
Great! so cool to see 2 awesome plugins working nicely together! kudos to msaari!
I reactivated Relevanssi , and it displays excerpts from protected posts according to my settings in s2member!