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™

S2Member and Wordpress Live Search

s2Member Plugin. A Membership plugin for WordPress®.

S2Member and Wordpress Live Search

Postby vitorclaw » April 11th, 2011, 2:24 pm

Hi, I`m using s2Member and daves live search plugin.

I already tried to apply the s2Member filters to the plugin search core but it doesn`t work. Private content still appearing for everyone.

Is there any kind of function to prevent this kind of behavior?

Thanks
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Cristián Lávaque » April 12th, 2011, 2:38 am

Hi. :)

Have you tried the alternative views settings? WP Admin -> Genearl Options -> Alternative View Protection
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: S2Member and Wordpress Live Search

Postby vitorclaw » April 12th, 2011, 8:13 am

Hi Cristián thanks for your reply, yes i already tried to change this setting but didn`t work. :(
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Cristián Lávaque » April 12th, 2011, 11:11 am

I guess that search plugin is not working with s2Member's protection, then.

You could probably implement it the access check using a function from the Advanced Query Conditionals. You can read about them here WP Admin -> s2Member -> API / Scripting -> Advanced Query Conditionals.

The developer of that plugin may be interested in having it work with s2Member and help 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: S2Member and Wordpress Live Search

Postby vitorclaw » April 12th, 2011, 2:56 pm

Hey Cristián, already tried to contact him, but i got no response until now. I`m sure that applying one of the filters to the live search plugin will fix the problem, I`ve already tried to apply it but with no success, i`ll take a deeper look at it if I get it working i`ll post it here. If someone have time to help me with that i would appreciate.
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » April 12th, 2011, 9:04 pm

Enabling s2Member's Alternative View Protection should work on this. Have you tried setting Alternative View Protection to "All" instead of just for search results? A custom search plugin may not register itself within WordPress Conditionals like: is_search(), but if you set Alternative View Protection to "All", it should work. In other words, s2Member might be unable to detect that these are search results, but setting Alternative View Protection to "All" would eliminate that issue for you.

Also, be sure that you test while logged-out. Or, while logged-in as a Member, NOT an Administrator.

If all else fails, open DavesWordPressLiveSearchResults.php, and find this section:
Code: Select all
        $wpQueryResults->query(array(
          's' => $_GET['s'],
          'showposts' => $maxResults,
          'post_type' => 'any',
          'post_status' => 'publish',
        )); 

Change it to:
Code: Select all
attach_s2member_query_filters();
        $wpQueryResults->query(array(
          's' => $_GET['s'],
          'showposts' => $maxResults,
          'post_type' => 'any',
          'post_status' => 'publish',
        ));
detach_s2member_query_filters(); 
~ 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: S2Member and Wordpress Live Search

Postby vitorclaw » April 12th, 2011, 9:50 pm

Hi Jason, thank you so much for answering my question. Unfortunatly none of those solutions worked. I tested it as admin, as member and as guest, but I`m still able to see the private posts on the search queries even with the query using the s2member filter. And I also tried to use all of alternative view protection options. Weird behaviour :(
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » April 12th, 2011, 9:57 pm

OK. Thanks for reporting back. If you have time, can you please email the plugin developer and point them to the post above? Perhaps they can chime in here and offer some assistance. viewtopic.php?f=4&t=3087&p=9635#p9627 * We'll continue to investigate in the mean time.
~ 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: S2Member and Wordpress Live Search

Postby vitorclaw » April 12th, 2011, 10:19 pm

Hey Jason, just sent him a pm on twitter and an e-mail, thanks for your concern :D
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » April 12th, 2011, 10:55 pm

Thank you!
Also, can you please confirm that you tried this?
Code: Select all
attach_s2member_query_filters();
        $wpQueryResults->query(array(
          's' => $_GET['s'],
          'showposts' => $maxResults,
          'post_type' => 'any',
          'post_status' => 'publish',
        ));
detach_s2member_query_filters();  
~ 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: S2Member and Wordpress Live Search

Postby vitorclaw » April 12th, 2011, 11:08 pm

Hi Jason, yes I did
Code: Select all
      attach_s2member_query_filters();
         $wpQueryResults->query(array(
            's' => $_GET['s'],
            'showposts' => $maxResults,
            'post_type' => 'any',
            'post_status' => 'publish',
         ));
      detach_s2member_query_filters();
        $this->searchTerms = $wpQueryResults->query_vars['s'];


Right here at line 61 right?
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby csixty4 » April 13th, 2011, 10:15 pm

Vitor,

Could you try a different change? Line 61 again. Take Jason's suggestion out and try this:

Code: Select all
$posts = $wpQueryResults->query(array(
's' => $_GET['s'],
'showposts' => $maxResults,
'post_type' => 'any',
'post_status' => 'publish',
));


Then, about 25 lines below that, replace:

Code: Select all
foreach($wpQueryResults->posts as $result)


with:

Code: Select all
foreach($posts as $result)
User avatar
csixty4
Registered User
Registered User
 
Posts: 2
Joined: April 13, 2011

Re: S2Member and Wordpress Live Search

Postby vitorclaw » April 13th, 2011, 11:08 pm

Hey Dave, first of all thank you so much for taking your time to help.

Well, I tried to change the code just like you said but the private post still appearing on the search, even when its not beign displayed at the latest posts section. I also tried to change the alternate view protection to all other options and the posts still appearing. Applying the s2member filter to the query doesn`t work either.

By the way I got a strange behaviour, i got this from firebug console

Code: Select all
{"searchTerms":"teste","results":[],"displayPostMeta":false}


No results, but I have a post named Teste, which appears when i`m logged as an admin
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby vitorclaw » April 16th, 2011, 6:26 pm

Hi guys, I`m still trying to find a solution for this, but I got nothing so far, the private posts still showing up when I`m using the live search :(
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » April 18th, 2011, 10:35 pm

OK. This seems to be related to the is_admin() Conditional, whenever AJAX requests are processed through /admin-ajax.php. You see, s2Member does NOT Filter queries processed inside admin panels for obvious reasons. However, as we've seen here, exceptions do exist ( i.e. Ajax search plugins ).

I'm attaching a patched file that can be uploaded to an existing installation of s2Member v3.5.8. Unzip the attached file, and upload it. Please allow this revised file to overwrite your existing copy of /s2member/includes/classes/querys.inc.php.

For Daves reference, and/or anyone else writing Ajax search plugins that you'd like to make compatible with s2Member's Query Filters, here is the section of code that was modified:
Code: Select all
if (!is_admin () /* The additional Ajax checks below, allow search plugins like Daves Live Search to be Filtered. Even when `is_admin() = true`.
See: `http://wordpress.org/extend/plugins/daves-wordpress-live-search/`. Also see: `http://www.primothemes.com/forums/viewtopic.php?f=4&t=3087#p12786`. */
|| (is_admin () && defined ("DOING_AJAX") && DOING_AJAX && !empty ($_REQUEST["action"]) && (did_action ("wp_ajax_nopriv_" . $_REQUEST["action"]) || did_action ("wp_ajax_" . $_REQUEST["action"])) && $wp_query->is_search ()))
    { 
Ajax 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. Just like Daves Live Search plugin.

querys.inc.php.zip
(2.68 KiB) Downloaded 32 times

Also, please make sure s2Member's Alternative View Protection is set to: Searches, Searches and Feeds, or Yes ( All ). Any of those options should do fine. In the case of Daves Live Search, also make sure that you've cleared your search result cache under the Advanced Tab of Daves Live Search plugin.

This issue should be resolved now.
Please write back to confirm, and then we'll have the changes included in the release of s2Member v3.6+.

100% Resolved ( awaiting confirmation )
~ 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: S2Member and Wordpress Live Search

Postby vitorclaw » April 18th, 2011, 11:55 pm

Hi Jason, I don`t even know how to thank you for that. Worked perfectly, you`re great!
User avatar
vitorclaw
Registered User
Registered User
 
Posts: 16
Joined: April 8, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » April 19th, 2011, 12:01 am

You're very welcome. Thanks for reporting back!
100% Resolved ( will be included with s2Member v3.6+ )
~ 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: S2Member and Wordpress Live Search

Postby csixty4 » April 22nd, 2011, 10:37 pm

Great detective work! I've always hated how anonymous users' queries have to go through admin-ajax.php, and this is a perfect example of why.
User avatar
csixty4
Registered User
Registered User
 
Posts: 2
Joined: April 13, 2011

Re: S2Member and Wordpress Live Search

Postby Guster » July 8th, 2011, 11:45 am

Hi there, I have an unusual problem that I need help with.
I have all of my level 1 pages restricted. I can access them with my admin account. But when my members get the level 1 membership they click on a level 1 page and it takes them to the membership options page.
So… For a test I put all the level 1 pages in level 0 and saved changes. Logged back into the site as a member instead of the admin, and it did the same thing as before (click on a level 1 page and it takes them to the membership options page).
Can you think of any reason for this?
User avatar
Guster
Registered User
Registered User
 
Posts: 2
Joined: June 21, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » July 8th, 2011, 5:10 pm

Guster wrote:Hi there, I have an unusual problem that I need help with.
I have all of my level 1 pages restricted. I can access them with my admin account. But when my members get the level 1 membership they click on a level 1 page and it takes them to the membership options page.
So… For a test I put all the level 1 pages in level 0 and saved changes. Logged back into the site as a member instead of the admin, and it did the same thing as before (click on a level 1 page and it takes them to the membership options page).
Can you think of any reason for this?
This sounds like your s2Member Roles have gotten corrupted somehow. Have you installed/used any of the User Role editing plugins? If all else fails, I would try deactivating s2Member, and then reactivate it so that your Roles/Capabilities get reset to the proper configuration.
~ 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: S2Member and Wordpress Live Search

Postby Guster » July 8th, 2011, 5:36 pm

I figured it out. I forgot that I put in all the member page ID’s in the “Specific Post/Page Access Restrictions”. I took them out and now it works great. Thanks again
User avatar
Guster
Registered User
Registered User
 
Posts: 2
Joined: June 21, 2011

Re: S2Member and Wordpress Live Search

Postby Jason Caldwell » July 8th, 2011, 7:08 pm

Ah. Thanks for reporting back.
~ that is MUCH appreciated!
~ 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: S2Member and Wordpress Live Search

Postby presson » September 2nd, 2011, 4:35 pm

Guster wrote:I figured it out. I forgot that I put in all the member page ID’s in the “Specific Post/Page Access Restrictions”. I took them out and now it works great. Thanks again


I'm wondering if there is a way to automate insertion in to these page restriction lists based on certain behaviors, like comments with certain keywords or something to that affect. i have been storing my data so that I have access via ediscovery, but I am on hold until I know what my capabilities are with this organized data. Have you ever heard of StoredIQ? It is an information governance provided.
Last edited by presson on September 22nd, 2011, 4:14 pm, edited 1 time in total.
User avatar
presson
Registered User
Registered User
 
Posts: 4
Joined: August 30, 2011

Re: S2Member and Wordpress Live Search

Postby Cristián Lávaque » September 2nd, 2011, 10:53 pm

s2Member doesn't come with that, but you can certainly code a customization that achieves it, if you wanted to. You'd have to monitor the comments and posts for those keywords and update the restriction based on that.

If you don't know enough PHP for this, you can get help from a freelance developer in websites like jobs.wordpress.net, eLance.com or oDesk.com.

I hope that helps. :)
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


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

cron