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™

Post/Page restriction not working (local issue?)

s2Member Plugin. A Membership plugin for WordPress®.

Post/Page restriction not working (local issue?)

Postby scripty » July 14th, 2010, 6:17 pm

I'm running into a problem where all pages and posts are being displayed when they shouldn't be. I have pages and posts restriction both set to "all" - I did confirm that a "membership" page is set and defined in the settings. I tried to access the site with another browser (to make sure it didn't see me as logged in) - and all pages and posts are displayed (not restricted). I was testing this out on a local copy of WordPress using the new default theme (twenty ten) - no other plugins are running.

Does this plugin have any known issues running on a locally hosted copy of WordPress (I'm running MAMP)

Thanks in advance for any help!
-Jennifer
User avatar
scripty
Registered User
Registered User
 
Posts: 5
Joined: July 14, 2010

Re: Post/Page restriction not working (local issue?)

Postby Jason Caldwell » July 14th, 2010, 9:02 pm

Hi Jennifer. Thanks for reporting this bug.

Yes, there is one minor change required.
Inside /includes/functions/is-systematic.inc.php, at line #37

Change this:
Code: Select all
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"])

To this:
Code: Select all
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && $_SERVER["REMOTE_ADDR"] !== "127.0.0.1")

If that does not work, you can change 127.0.0.1 to whatever your localhost IP is. I'll have this updated in the next release so that local installations will work without this manual edit.
~ 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: Post/Page restriction not working (local issue?)

Postby scripty » July 14th, 2010, 9:42 pm

PHEW! I thought I was going crazy. That did work - but strangely instead of an IP I had to put this in instead:
::1
I'm not a MAMP expert, so I don't know why that is - but that's the value it returns for $_SERVER["REMOTE_ADDR"]

Thanks!
-Jennifer
User avatar
scripty
Registered User
Registered User
 
Posts: 5
Joined: July 14, 2010

Re: Post/Page restriction not working (local issue?)

Postby Jason Caldwell » July 14th, 2010, 10:13 pm

OK, cool. Thanks for your response Jennifer.

So maybe a better solution is this:
Code: Select all
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && !preg_match ("/^localhost$/i", $_SERVER["HTTP_HOST"]))

If you have a minute to test this on your MAMP installation, I would be very grateful.
~ 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: Post/Page restriction not working (local issue?)

Postby scripty » July 14th, 2010, 10:33 pm

That doesn't seem to do the trick. With that line in place, it's showing me all the pages it's not supposed to be.

Not sure if this is helpful or not, but with MAMP - it goes through a port... so the URL looks like this:
http://localhost:8888/
User avatar
scripty
Registered User
Registered User
 
Posts: 5
Joined: July 14, 2010

Re: Post/Page restriction not working (local issue?)

Postby Jason Caldwell » July 14th, 2010, 10:49 pm

OK. Thank you very much. Here is another attempt that takes the port number into account as well.
Code: Select all
else if ($_SERVER["REMOTE_ADDR"] === $_SERVER["SERVER_ADDR"] && !preg_match ("/^localhost(\:[0-9]+)?$/i", $_SERVER["HTTP_HOST"]))
~ 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: Post/Page restriction not working (local issue?)

Postby scripty » July 14th, 2010, 10:54 pm

That works! Thanks!
User avatar
scripty
Registered User
Registered User
 
Posts: 5
Joined: July 14, 2010

Re: Post/Page restriction not working (local issue?)

Postby Jason Caldwell » July 14th, 2010, 11:01 pm

Beautiful. Thanks for the help!
- This will be committed to s2Member v3.1.3+ ... to be released soon.
~ 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: Post/Page restriction not working (local issue?)

Postby Jason Caldwell » July 14th, 2010, 11:08 pm

Jennifer. I just sent you a login for s2Member.com; which includes a free copy of s2Member Pro, with unlimited domain licensing and the s2Clean Theme. ~Thanks again for the assistance. Much appreciated!

Just send me a list of domains and/or IP addresses via email and I'll send over your licenses on demand.
~ 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: Post/Page restriction not working (local issue?)

Postby scripty » July 14th, 2010, 11:14 pm

You totally rock!! Thanks so much! :D
User avatar
scripty
Registered User
Registered User
 
Posts: 5
Joined: July 14, 2010

Re: Post/Page restriction not working (local issue?)

Postby Jason Caldwell » July 22nd, 2010, 11:43 pm

"localhost" support added in s2Member v3.1.4+.
~ Thanks again.
~ 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


Return to s2Member Plugin

Who is online

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

cron