PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Relevanssi version 2.9.7 and s2member version 110731

s2Member Plugin. A Membership plugin for WordPress®.

Relevanssi version 2.9.7 and s2member version 110731

Postby tasitasi » August 10th, 2011, 8:13 am

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
User avatar
tasitasi
Registered User
Registered User
 
Posts: 13
Joined: August 10, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Cristián Lávaque » August 10th, 2011, 12:54 pm

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#p12882

Jason 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?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby tasitasi » August 10th, 2011, 6:19 pm

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.
User avatar
tasitasi
Registered User
Registered User
 
Posts: 13
Joined: August 10, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby tasitasi » August 12th, 2011, 9:59 pm

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!
User avatar
tasitasi
Registered User
Registered User
 
Posts: 13
Joined: August 10, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Cristián Lávaque » August 12th, 2011, 10:13 pm

What did the developer of Relevanssi tell you about what I mentioned earlier? viewtopic.php?f=4&t=14398#p30397
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby tasitasi » August 12th, 2011, 10:30 pm

I have just emailed the developer now, hopefully they will view this thread.
User avatar
tasitasi
Registered User
Registered User
 
Posts: 13
Joined: August 10, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby tasitasi » August 13th, 2011, 1:43 am

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.
User avatar
tasitasi
Registered User
Registered User
 
Posts: 13
Joined: August 10, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby tasitasi » August 13th, 2011, 4:36 am

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
User avatar
tasitasi
Registered User
Registered User
 
Posts: 13
Joined: August 10, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Cristián Lávaque » August 13th, 2011, 12:59 pm

That is awesome! Thanks for the update and please tell the developer to contact us if he needs anything. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 14th, 2011, 6:06 am

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.
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Cristián Lávaque » August 15th, 2011, 2:42 pm

Thanks for the kudos and it's great to know that the plugins are now working together fine. Thank you! :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby arthomas » August 19th, 2011, 11:23 am

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)
User avatar
arthomas
Registered User
Registered User
 
Posts: 19
Joined: September 21, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 19th, 2011, 11:36 am

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.
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby arthomas » August 19th, 2011, 12:03 pm

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.
User avatar
arthomas
Registered User
Registered User
 
Posts: 19
Joined: September 21, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 19th, 2011, 12:21 pm

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.
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby arthomas » August 19th, 2011, 12:27 pm

Thanks Msaaari,

Jason, is there such an option?
User avatar
arthomas
Registered User
Registered User
 
Posts: 19
Joined: September 21, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Cristián Lávaque » August 19th, 2011, 10:04 pm

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?
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 21st, 2011, 1:18 pm

I don't know how to respect the setting, so no, Relevanssi doesn't care about it.
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Jason Caldwell » August 23rd, 2011, 7:05 pm

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))
    {
        // Show title and excerpt, even full content if you like.
        // The current User/Member has access to Post or Page ID: 123.
    }
else if(!is_permitted_by_s2member(123) && $completely_hide_protected_search_results === false)
    {
        // Show title and excerpt. Alt View Protection is NOT enabled for search results. However, do NOT show full content body.
        // The current User/Member has no access to this content, but Alt View Protection is NOT enabled for search results.
        // So in this case, s2Member site owners would expect to see protected titles/excerpts in search results.
    }
else /* Do NOT show the search result at all. */
    {
        // Hide this search result completely.
        // The User does not have access to this content, and Alt View Protection IS enabled for search results.
    }
?>
* See also, docs here: viewtopic.php?f=40&t=12453&src_doc_v=110815#src_doc_is_permitted_by_s2member%28%29
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 24th, 2011, 12:28 pm

Thanks, this is exactly what I need. I'll fix this in the next version.
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 27th, 2011, 12:44 pm

With the option 2 ("Show title and excerpt."), is showing the results of get_the_excerpt() ok?
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Jason Caldwell » August 27th, 2011, 3:58 pm

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.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby msaari » August 27th, 2011, 9:30 pm

Great. Relevanssi Premium 1.6 now has upgraded s2member support and the free version will have it too in the next release.
User avatar
msaari
Registered User
Registered User
 
Posts: 9
Joined: August 14, 2011

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby Cristián Lávaque » August 28th, 2011, 2:05 am

Great! :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Relevanssi version 2.9.7 and s2member version 110731

Postby arthomas » September 4th, 2011, 2:50 pm

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!
User avatar
arthomas
Registered User
Registered User
 
Posts: 19
Joined: September 21, 2010

Next

Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest

cron