Page 1 of 1

Registration Disabled

PostPosted: May 23rd, 2011, 12:46 pm
by thuynh
Our product is currently registered with clickbank and we've tested out by paying with real credit and everything. However, upon payment completion, we got sent to /wp-login.php?action=register. However, it kept saying that User registration is currently not allowed. For some reason, get_option('users_can_register') is always set to false. We're currently using version 3.3.2.

Also, while digging through the s2member code, I did notice something and was hoping that this is correct. In the file /s2member/includes/function/force-options.inc.php.

Line 103:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());

Shouldn't this be:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register == "0"), get_defined_vars ());

Line 110:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());

Shouldn't this be:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register == "1"), get_defined_vars ());

Thanks

Re: Registration Disabled

PostPosted: May 23rd, 2011, 1:37 pm
by Cristián Lávaque
The value is being assigned, not compared, so = is fine.

So your problem is that users complete checkout in ClickBank and get sent to /wp-login.php?action=register? That return URL is wrong, though, it should be http://yoursite.com/?s2member_pro_clickbank_return=1 so s2Member creates the cookies required to let the person register the account.

If you need customers to land on a custom thank-you page, you can have the cookies created with this hack:

Create the directory/file /wp-content/mu-plugins/s2hacks.php (mu: must use) and add this code (no spaces or new lines before the <?php or after ?>)

Code: Select all
<?php
add_action ('ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars', 'my_clickbank_return');
function my_clickbank_return () {
    if ($_REQUEST['s2member_paypal_proxy'] === 'clickbank') {
        echo '<script type="text/javascript">' . "\n";
        echo "window.location = 'http://yoursite.com/custom-thankyou';" . "\n";
        echo '</script>' . "\n";
        /*
        Note. Don't use wp_redirect() or header("Location: xxx") here.
        The cookies set by s2Member may not be read properly.
        Always use window.location = ''; ( as shown above ).
        */
        exit ();
    }
}
?>


I hope it helps. :)

Re: Registration Disabled

PostPosted: May 23rd, 2011, 1:52 pm
by thuynh
I'm not sure i'm convinced about the assignment vs the comparison issue. I've already gotten the redirection to the thank you page working so that part is good. I do see cookies being set using firebug:

s2member_subscr_id
s2member_level
s2member_custom

When users click on register from my thank you page, they're sent to /wp-login.php?action=register. There's a code in the wp-login.php that checks get_option('users_can_register') which then land on this method in s2member ws_plugin__s2member_check_register_access. Inside this method, there's a check:

Code: Select all
$by_default = $users_can_register = $GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["allow_subscribers_in"];


The variable $users_can_register is set to 0 for me.

So when it hits the first check:

Code: Select all
if (is_multisite () && ws_plugin__s2member_is_multisite_farm () && is_main_site ())
               return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());


The assignment basically just set it to false every time. Please shed some lights.

Re: Registration Disabled

PostPosted: May 23rd, 2011, 2:38 pm
by Cristián Lávaque
That code you quoted will happen only if the condition of being the main site of a mulsite network set up as a blog farm is met. That said, even if it happened everytime, the bit you call a check is just a value assignment to one of the parameters of the apply_filters function being called. So you don't need to worry about = being a typo instead of ==. :)

I'm glad you got your registrations to work. How did you solve it?

Re: Registration Disabled

PostPosted: May 23rd, 2011, 2:47 pm
by thuynh
Yes that's exactly what it is. The main site is part of the multisite network. I've verified all the condition individually that condition is hit every single time. I set the = to == to fix it but it's probably not a good idea. For some reason, registration just seems to be disabled even with all the proper cookies, etc set.

http://XXXXXX.com/?s2member_pro_clickbank_return=1&item=1&cbreceipt=GKYW70NEPF4&time=1306167574&cbpop=11C00950&cbaffi=0&cname=Thai+Huynh&cemail=me%40thaihuynh.com&ccountry=US&czip=78660&s2_invoice=1&s2_desc=Some+Description&s2_custom=XXXXXX.com

This is the URL that got returned.

Re: Registration Disabled

PostPosted: May 23rd, 2011, 2:59 pm
by Cristián Lávaque
Could you share here the log entry for it (x'ing out private info)?

OK, so you have a multiste network set up, but you're selling this from the main blog, and when the person comes back, although it's the URL that s2Member asked for the return and the cookies are set, the person is not allowed to register?

Re: Registration Disabled

PostPosted: May 23rd, 2011, 3:18 pm
by thuynh
So the flow is this. We have a sale site on eznichebuilder.com sitting on a separate Single WP installation. Users click on Buy Now from this site and get sent to Clickbank. Upon payment completion, user is sent to eznichepages.com which is where the s2member lives. eznichepages.com is the main site of the farm. You can see the button on http://www.eznichebuilder.com/buy-now/. After users come back from Clickbank, s2member set cookies then the hook ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars will send them back to eznichebuilder.com/thank-you. This is one of clickbank's requirement so we had to send users back to the sale site. From the sale site, there's a link to go back to eznichepages.com to register. This link simply points to http://eznichepages.com/wp-login.php?action=register. Since cookies are already set, s2member should be able to pick it up and continue. However, it just says Registration disabled. Without that ==, it won't work.

Here is clickbank-rtn.log

Code: Select all
eznichepages.com/?s2member_pro_clickbank_return=1&item=1&cbreceipt=XXXXXX&time=1306167574&cbpop=XXXXXX&cbaffi=0&cname=XXXXXX&cemail=XXXXXX&ccountry=US&czip=Zipcode&s2_invoice=1&s2_desc=EZNicheBuilder+Content+Site+Builder+++Unique+Articles&s2_custom=eznichepages.com
array (
  'item' => '1',
  'cbreceipt' => 'XXXXXX',
  'time' => '1306167574',
  'cbpop' => 'XXXXX',
  'cbaffi' => '0',
  'cname' => 'XXXXXX',
  'cemail' => 'XXXXXX',
  'ccountry' => 'US',
  'czip' => 'XXXXXX',
  's2_invoice' => '1',
  's2_desc' => 'EZNicheBuilder Content Site Builder   Unique Articles',
  's2_custom' => 'eznichepages.com',
  's2member_log' =>
  array (
    0 => 'Return-Data received on: Mon May 23, 2011 7:45:54 pm UTC',
    1 => 's2Member POST vars verified with ClickBank®.',
    2 => 'Sleeping for 5 seconds. Giving ClickBank® a chance to finalize processing.',
    3 => 'Awake. It\'s Mon May 23, 2011 7:45:59 pm UTC. Processing will continue.',
    4 => 'Order API variables have been obtained from ClickBank®.',
    5 => 'ClickBank® transaction identified as (SALE/STANDARD).',
    6 => 'Return-Data reformulated. Piping through s2Member\'s core/standard PayPal® processor as txn_type (web_accept).',
    7 => 'Please check PayPal® RTN logs for further processing details.',
    8 => 'http://eznichepages.com/?s2member_paypal_return=1&s2member_paypal_proxy=s2member-pro-module&s2member_paypal_proxy_use=standard-emails&s2member_paypal_proxy_verification=XXXXXXX&txn_type=web_accept&txn_id=XXXXXX&custom=eznichepages.com&mc_gross=XXXXX&mc_currency=USD&tax=0.00&payer_email=XXXXXX&first_name=XXXXXX&last_name=XXXXXX&option_name1&option_selection1&item_number=1&item_name=EZNicheBuilder+Content+Site+Builder+++Unique+Articles',
  ),
  's2vars' =>
  array (
    's2_invoice' => '1',
    's2_desc' => 'EZNicheBuilder Content Site Builder   Unique Articles',
    's2_custom' => 'eznichepages.com',
  ),
)


paypal-rtn.log
Code: Select all
eznichepages.com/?s2member_paypal_return=1&s2member_paypal_proxy=s2member-pro-module&s2member_paypal_proxy_use=standard-emails&s2member_paypal_proxy_verification=XXXXXX&txn_type=web_accept&txn_id=XXXXXX&custom=eznichepages.com&mc_gross=XXXXXX&mc_currency=USD&tax=0.00&payer_email=XXXXXX&first_name=XXXXXX&last_name=XXXXXX&option_name1&option_selection1&item_number=1&item_name=EZNicheBuilder+Content+Site+Builder+++Unique+Articles
array (
  'txn_type' => 'web_accept',
  'txn_id' => 'XXXXXX',
  'custom' => 'eznichepages.com',
  'mc_gross' => 'XXXXXX',
  'mc_currency' => 'USD',
  'tax' => '0.00',
  'payer_email' => 'XXXXXX',
  'first_name' => 'XXXXXX',
  'last_name' => 'XXXXXX',
  'option_name1' => '',
  'option_selection1' => '',
  'item_number' => '1',
  'item_name' => 'EZNicheBuilder Content Site Builder   Unique Articles',
  'proxy_verified' => 's2member-pro-module',
  's2member_log' =>
  array (
    0 => 'Return-Data received on: Mon May 23, 2011 6:43:48 pm UTC',
    1 => 's2Member POST vars verified through a POST back to PayPal®.',
    2 => 's2Member originating domain ( _SERVER[HTTP_HOST] ) validated.',
    3 => 's2Member txn_type identified as (web_accept|subscr_signup|subscr_payment).',
    4 => 's2Member txn_type identified as (web_accept|subscr_signup|subscr_payment) w/o update vars.',
    5 => 'Registration Cookies set on (web_accept|subscr_signup|subscr_payment) w/o update vars.',
    6 => 'Redirecting Customer to Registration Page. They need to Register now.',
  ),
  'subscr_id' => 'XXXXXX',
  'eotper' => NULL,
  'ccaps' => NULL,
  'level' => '1',
  's2member_paypal_proxy' => 's2member-pro-module',
  's2member_paypal_proxy_use' => 'standard-emails',
  's2member_paypal_proxy_verification' => 'XXXXXX',
)


Re: Registration Disabled

PostPosted: May 23rd, 2011, 3:59 pm
by Cristián Lávaque
OK, I understand better now.

So you have the sales page over at www.eznichebuilder.com but all the ClickBank set up is done with eznichepages.com (where the user's account will be) or did you mix them in the configuration?

When the person returns from ClickBank to eznichepages.com how are you taking him back to www.eznichebuilder.com?

Also, since you use www in one and not in the other, I think it may be good that you keep this in mind, just in case: http://www.primothemes.com/forums/viewtopic.php?f=36&t=1066

By the way, the change you made to the code seems to have opened registrations because I went to the registration form and was able to create an account without a stop. (You can delete the account I created, of course.)

Re: Registration Disabled

PostPosted: May 23rd, 2011, 4:11 pm
by thuynh
Account removed.

When the person returns from ClickBank to eznichepages.com, I'm using the following code to send them over to eznichebuilder.com.

Code: Select all
add_action ('ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars', 'clickbank_handler');
function clickbank_handler() {
   echo '<script type="text/javascript">' . "\n";
   echo "window.location = 'http://www.eznichebuilder.com/thank-you?full_name=".$_REQUEST['first_name']." ".$_REQUEST['last_name']."&email=".$_REQUEST['payer_email']."';";                           
   echo '</script>' . "\n";   
   exit();
}


This page has nothing more than just a message. Like I mention, Clickbank requires a thank you page in order to have the product approved.

As for the www vs non-www, everything on eznichepages.com should be non-www. However, eznichebuilder.com is www. I don't think that should matter since cookies are set for eznichepages.com right?

I guess it's not a good idea to change = to ==.

Re: Registration Disabled

PostPosted: May 23rd, 2011, 7:16 pm
by Jason Caldwell
thuynh wrote:Line 103:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "0"), get_defined_vars ());

Shouldn't this be:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register == "0"), get_defined_vars ());

Line 110:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register = "1"), get_defined_vars ());

Shouldn't this be:
return apply_filters ("ws_plugin__s2member_check_register_access", ($users_can_register == "1"), get_defined_vars ());
Cristián Lávaque wrote:The value is being assigned, not compared, so = is fine.
Cristián is correct. The value is being assigned, not compared.
So the existing code with just one = sign is correct.

I will reply about the issue detailed here momentarily.

Re: Registration Disabled

PostPosted: May 23rd, 2011, 7:21 pm
by Jason Caldwell
So the flow is this. We have a sale site on eznichebuilder.com sitting on a separate Single WP installation. Users click on Buy Now from this site and get sent to Clickbank. Upon payment completion, user is sent to eznichepages.com which is where the s2member lives. eznichepages.com is the main site of the farm. You can see the button on http://www.eznichebuilder.com/buy-now/. After users come back from Clickbank, s2member set cookies then the hook ws_plugin__s2member_during_paypal_return_during_subscr_signup_wo_update_vars will send them back to eznichebuilder.com/thank-you. This is one of clickbank's requirement so we had to send users back to the sale site. From the sale site, there's a link to go back to eznichepages.com to register.

This link simply points to http://eznichepages.com/wp-login.php?action=register.

Since cookies are already set, s2member should be able to pick it up and continue. However, it just says Registration disabled. Without that ==, it won't work.

On a Multisite installation, if you configure s2Member to run as a Blog Farm ( i.e. s2Member -> Mulitisite (Config) ), then s2Member locks down /wp-login.php?action=register completely, and instead, you must use the Multisite Registration Form for WordPress instead ( /wp-signup.php ). So just change your custom redirection to point to /wp-signup.php, or change your s2Member -> Multisite ( Config ) options to unlock /wp-login.php?action=register

Re: Registration Disabled

PostPosted: May 23rd, 2011, 10:41 pm
by thuynh
OK so I reverted == back to =, updated to do NOT allow Open Registration, and redirect users back to wp-signup.php. However, this will allow anyone to register event with the option do NOT allow Open Registration. I guess this is not really a big deal for our use case since Subscribers can't really create blogs.

Re: Registration Disabled

PostPosted: May 23rd, 2011, 10:53 pm
by Jason Caldwell
Not to worry. s2Member protects /wp-signup.php in the same way it protects /wp-login.php?action=register on a standard installation. If Open Registration is off ( i.e. do NOT allow Open Registration ), then your /wp-signup.php file should unavailable to non-paying Customers. However, if you are logged-in as an Administrator, *you* will be able to see it.