Page 1 of 1

restrictions not working at all :(

PostPosted: August 9th, 2011, 4:25 pm
by Paulo
Hi there,

First of all, thank you for the great plugin. I think once I resolve this problem, the plugin will be tremendously useful for my project.

I am using WP 3.2.1 + Buddypress 1.2.9
S2Member Version 110731 (as displayed in WP plugin page)
Running on Apache Windows Test Server

Problem:
None of the restrictions seem to be working. As a basic test. I specified 'all' posts to require level 04 membership. However, the post is still visible to a non logged-in member.

Discovery:
After hours of digging, I think I may have discovered the culprit.

The plugin seems to check for five conditions to determine if post is restricted in posts.inc.php:

1. ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["login_redirection_override"]
2. ($login_redirection_uri = c_ws_plugin__s2member_login_redirects::login_redirection_uri ($user, "root-returns-false"))
3. preg_match ("/^" . preg_quote ($login_redirection_uri, "/") . "$/", $_SERVER["REQUEST_URI"])
4. c_ws_plugin__s2member_no_cache::no_cache_constants (true) !== "nill"
5. (!$user || !current_user_can ("access_s2member_level0")))

I found that 'login_redirection_uri' is '/^\/login-welcome-page\/$/'
and $_SERVER["REQUEST_URI"] is '<my_post_permalink>'

hence, condition 3 failed to match the two strings.

What is the correct behaviour? What should the values be supposedly?

Please help.

Thanks in advance!

-Paul

Re: restrictions not working at all :(

PostPosted: August 9th, 2011, 9:31 pm
by Bruce C
I tested on my wamp server, it appears to be working alright for me.

Maybe try deleting and reinstalling? Perhaps a setting got messed up somewhere.

Re: restrictions not working at all :(

PostPosted: August 9th, 2011, 11:57 pm
by Paulo
Thanks for your reply. Tried deleting it and reinstalled, still no go :(

Would anyone be so kind as to tell me what values of '$login_redirection_uri' and '$_SERVER["REQUEST_URI"]' that you are getting within /includes/classes/posts.inc.php? Then I can try to see what went wrong.

Re: restrictions not working at all :(

PostPosted: August 10th, 2011, 12:02 pm
by Cristián Lávaque
Hi Paulo.

Watch this video and tell me if it helps with your problem: http://www.s2member.com/content-restric ... ble-video/

And because you mentioned the Login Welcome Page, here's a video in case you're having trouble with that too: http://www.s2member.com/login-welcome-p ... cts-video/

Let me know if that helps.

Re: restrictions not working at all :(

PostPosted: August 10th, 2011, 12:28 pm
by Paulo
Thanks for your reply. I have seen the videos before, and unfortunately do not address the same issues. In particular, the restrictions do not seem to apply at all, not even for visitors (people who are not logged in) so the Login Member Page redirect issue is rather a separate issue.

Could this be a legitimate problem with s2member + buddypress?

Re: restrictions not working at all :(

PostPosted: August 10th, 2011, 1:40 pm
by Cristián Lávaque
OK.

Could you create a test account at Level 0 (subscriber) and give me the login details? Also the URL to a post restricted at Level 1 and another at Level 2, please.

Re: restrictions not working at all :(

PostPosted: August 11th, 2011, 12:09 pm
by Paulo
Hi, I am on a testing local server with no domain name and external access blocked. I could provide those details in the near future once it is at a stage to be put on a live server.

Thanks again for your help.

Re: restrictions not working at all :(

PostPosted: August 11th, 2011, 12:34 pm
by Cristián Lávaque
Got it.

By the way, regarding the local server, here's a tip that may help:

Jason Caldwell wrote:Try adding this line to your /wp-config.php file.
Code: Select all
define("LOCALHOST"true);  
s2Member has a special routine, which we refer to as the Systematics Routine. It sees your IP address is the same as the server's IP; which is sometimes an issue on a WAMP/MAMP installation. It's fine so long as your domain is http://localhost/. However, if it's something other than that, you'll need to add that line in your /wp-config.php file so s2Member realizes it's running on a localhost installation.


I hope that helps.

Re: restrictions not working at all :(

PostPosted: August 16th, 2011, 3:06 pm
by Paulo
That's it!! Thanks so much!

Re: restrictions not working at all :(

PostPosted: August 17th, 2011, 3:19 am
by Cristián Lávaque
:)