Page 1 of 1

Bug: MS 3.0 Subscriptions dont work for unregistered users

PostPosted: June 30th, 2010, 10:23 am
by jannesh
Hi

I discovered a problem with the new s2Member and WPMS/BuddyPress. I dont know if it is specific to MS. My configuration use WP 3.0 with MS enabled, BuddyPress 1.2.5 and s2Member 3.1.2.

This is for a new guest that does not have a subscription yet. If I browse the blog and try to access a page with restricted access, I get redirected to the Subscriptions page, great!. However after I have subscribed (been to PayPal and all) and I have filled in my new user info and I want to view the page I get the Subscription page again. Turns out the previous subscription did not work. I was subscribed to the blog but my role is 'Subscriber' not 's2Member Level 1' as it should be. Note, the money did go of my PayPal account...

Turns out the 'registration' part where I put in my username and other details, overwrite the 'subscription' details already recorded by s2Member.

I hacked away at the s2Member code and got it to work. Basically after I have identified that the page is indeed restricted, I dont do a straight redirect to the 'subscribe' page. I first check if the user is logged in at all, if not go to a register page, else if the user does not have sufficient level, go to subscribe, else (the user has sufficient level) display the page.

My code in 'page-level-access.inc.php' looks like this:
Code: Select all
else if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"] &&
         in_array ($page_ID, preg_split ("/[\r\n\t\s;,]+/",
                   $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["level1_pages"])) &&
         ws_plugin__s2member_nocache_constants (true) !== "nill") {
  if (!$current_user) {
    if (wp_redirect(add_query_arg ("s2member_level_req", "1",get_page_link(14)))
                                                                                                      !== "nill") {
      exit();
    }
  }
  else if (!current_user_can ("access_s2member_level1")) {
    if (wp_redirect(add_query_arg("s2member_level_req", "1",
                    get_page_link ($GLOBALS["WS_PLUGIN__"]["s2member"]
                                  ["o"]["membership_options_page"]))) !== "nill") {
      exit ();
    }
  }
}


The page ID 14 in there is the hard-coded page number for the register page I use to give the user an option to either login or register.

JannesH

Re: Bug: MS 3.0 Subscriptions dont work for unregistered use

PostPosted: June 30th, 2010, 5:10 pm
by Jason Caldwell
Hi JannesH. Thanks for these code samples. Much appreciated.

s2Member ( as of v3.1.2 ), is NOT yet compatible with Multisite Networking in WP 3.0. We are working on this, and you can expect to see full ( improved ) support for Multisite Networking in a future release. I suspect somewhere around 3.1.5 or so.

Re: Bug: MS 3.0 Subscriptions dont work for unregistered use

PostPosted: July 3rd, 2010, 1:58 pm
by mercure80
Hello!
I am experiencing the same issue, running BP + WP 3.0 with 4 community blogs.
I look forward to WP MS support shortly.
Great work and great plugin!
Marc-O.

Re: Bug: MS 3.0 Subscriptions dont work for unregistered use

PostPosted: July 7th, 2010, 6:13 pm
by Jason Caldwell
Thanks Marc-O.
Absolutely. ~This is high on our priority list.