latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Richard Mataka

My Latest Replies (From Various Topics)

Viewing 22 replies - 26 through 47 (of 47 total)
Author Replies
Author Replies
Posted: Wednesday Jul 11th, 2012 at 9:43 pm #18970

Hey Chris

I found an important piece of code here

if ($existing_role !== $demotion_role) /* Only if NOT the existing Role. */
$user->set_role ($demotion_role); /* Give User the demotion Role. */

Maybee if i can tell that EOT this script was processing I can tell how to demote the users role
so i’m seeing here this

Since you only store 1 subscription and EOT. Then its basically going to demote the user to the s2 options demotion level no matter what

The question i have here – is any of the IPN variables available at this point. this way i can tell if
its a level 2 or level 1 being cancelled? or if not then this patch wont work because i have to depend
on the DB variables that are already stored

so then the question here is – say the stored IPN is LEVEL 1 and then they buy LEVEL 2 – is the stored
IPN varibles overwritten or added to?

I guess my answers will be in the subsciber modify file – im going to keep on digging. However one thing that
confuses me here. The modify file seems to only modify logged in users – unless im missing something here completely

And sorry to be a pain – but – I see alot of apply_filters() but when i search for the filter name like


I cannot find function s2member_user_access_role()

Anyway thanks again



Posted: Wednesday Jul 11th, 2012 at 9:06 pm #18969

Hey Chris

Few things

1) Can you tell me why this is needed in every class

eval (‘foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;’);

2) In


Is this used to validate the transients ? Cause i see ms_ (multi site) and then non ms_ functions
my install is not MS – so i just want to verify that im working with the right functions

Thanks Bud

Posted: Wednesday Jul 11th, 2012 at 8:29 pm #18966

Hey Christian

Thanks for the informative and deatiled response. This should be what i need to try to patch and modify
exisiting subscriptions. What im thinking here. Is that in the


Files is what really handles the user subscriptions as far as upgrading and adding to user accounts
so i may be able to patch that logic in order to allow 2 subscriptions, as long as the transients are
handled in there.

Thanks again bro!

Posted: Tuesday Jul 10th, 2012 at 5:43 pm #18837

Hi Christian

Thanks for the input here. It seems almost impossible by design to be able to achieve concurrent subscriptions without haveing to rewrite the core payment framework, which I dont have time to do.

So this leaves me in a pickle here. If I have to move to WishList, which they say can do it, i have to undoo a shit
ton of customizations I already made in s2 and I dont want to have to go that route if nessseary.

Im a lead developer myself with 11 years experince. I understand work load, but in not asking for detailed
PHP code – im asking for

1) Clickbank Returns – THIS FILE
2) Then It process to PayPal – THIS FILE
3) Then it sends the members email – THIS FILE
4) It does the storing of the transets – THIS FILE

I just need the flow and I may be able to come up with a patch. This issue is you have 2 sets of PayPal files
one in the original framework and on in the /pro/ framework. Im just unsure whats being called and where
so if he can provide a small Map of the Clickbank to Registration process, just showing me the files I may be about
to get this to work.

I had wasted 6 hours yesterday going through the files… the naming conventions are hard to follow as I dont understand the core (I guess good Job Security LOL)

Anyway – if I disable the EOT that means that the members will happily have access even on a cancellation. So i guess we can just do this manually then. (thats another thing) I dont see any clickbank EOT files. where is this in PayPal? I seems that everything is routed in PayPal. – So is this the s2members folder or the /pro/ folder paypal files then you have PDN and IPN retunrs… its just confusing really to be honest with you.

Anyway so if i disable the EOT then a customer refunds I would have to manually adjust access. Now you mention a script? Can i write any EOT hacks there?

Once thing I really dont get is th IPN storage – transets – why this is in the wp_options table makes no sense to me
and im not sure what hooks are deleting them, and checking them.. you have tons of validations going on from every angle.. its just complex (without being the actual coder) on this project.

Anyway if you can give me some flow insights – hook work arounds im not aware of to hack functionality of
s2member that would be great. Other wise – i may have to move to wishlist and start this @ square one which im trying not to right now…


Posted: Monday Jul 9th, 2012 at 10:39 pm #18749

Ok I just figured that out.. basiclly if the cookies are not there it wont allow access. Thats great! One down one more to go.. if your Lead Dev can give me some insight as to where i should be modifying the multiple subscription proccess would be aweome.


Posted: Monday Jul 9th, 2012 at 10:24 pm #18745

All in need to do, is give them a link to the register page on the thank you page how the heck can you do this?

Posted: Monday Jul 9th, 2012 at 10:08 pm #18744

Hey Cristian

Im trying to get the register link into continue button on the thank you page
I see

$registration_url = c_ws_plugin__s2member_register_access::register_link_gen ($paypal["subscr_gateway"], $paypal["subscr_id"], $paypal["custom"], $paypal["item_number"])

But I have NO idea how to access these variables on the thank you page..

this is getting very fustrating here.. there should be an option to send the user to a registration page after signup

Posted: Monday Jul 9th, 2012 at 8:21 pm #18730

Hey Guys

Thanks for helping out here, the code flow is just so embeded and there is so much verfication going on
that its hard for me to pinpoint what needs to be done.

The other thing that needs to be done here, is after the sucessfull purchase, i need to take the user
1st to the thank you page, 2nd to the register page. Right now it seems that the tinyurl link
is being processed by the IPN in the background. I just need to know where the verification happens
that allows the user to register, so I can put a link to the register from the thank you page.


Posted: Monday Jul 9th, 2012 at 6:09 pm #18709

it be nice if you can get the lead devloper here, to post his thoughts on the registration flow.. cause I see 2 sets of paypals files and alot of redirects.. its just way to complex of code to start hackin at without knowing some things about it first… i’m on a tight schedule here.. so your guidance in getting some of these questions here will help greatly

Posted: Monday Jul 9th, 2012 at 6:05 pm #18708

Hey Guys

The code is WAY to embeded to store 2 subscriptions. It seems that 80% of the code needs to be
rewriiten to do this.. unless i’m missing something here

Posted: Monday Jul 9th, 2012 at 4:48 pm #18702

OK, after looking through the code that is very deeply nested in architecture, a little guidence in code flow
would help tremendously.

1) Where does it downgrade or upgrade a member, i see that it funnels through PayPal. So im trying to figure out
where it actually – 1 inserts the member, or stores the meta data.. I see something from the IPN is being
stored waiting on user signup, to be verified. I cant seem to find it tho

2) If you can explain the flow process a bit here would be greatly helpful.


Posted: Monday Jul 9th, 2012 at 10:55 am #18668

Hey Cristian

Unfortunately, the second subscription is just an upgrade to access more areas in the members site. What would really need to happen is – If user is Level 1 and EOT then level 0 OR if user is level 2 and EOT then level 1.

The issue with that logic. Is if they cancel level 1 & 2 – and they are level 2, then EOT should be level 0
But that’s more impossible to do, because were not storing thr subscription data. So I would have to store the
subscription data and then do the logic based on that.

So that sparks a question. How does s2 know to upgrade a current user to level 2 and the EOT a level 2?
if there is no subscription data held. Im guessing this is all by IPN


Posted: Sunday Jul 8th, 2012 at 9:53 pm #18637

Ok – I love the challenge, tho im on a tight time schedule. Is there any way I can contract you for custom work, as you seem to know the code already. I mean ill have no choice but to hack at it. But I figured Id ask :)

Posted: Sunday Jul 8th, 2012 at 9:37 pm #18635


Can you point me to the files that handle the subscription logic for clickbank? I need to write
some custom code to be able to handle 2 subscriptions and not lock out a user because last
subscription issue above.


Posted: Friday Jul 6th, 2012 at 12:20 pm #18491

Hey Thanks for getting back to me


if (!empty($_GET['s2member_pro_clickbank_return']))
$_GET['s2member_pro_clickbank_return_success'] = ';;

Where do I put this? I dont see a mu_plugin dir

2) Thats fine I will create my own, however. I need to know a few things, where does the Token
thats in the email creation link ( stored? Like I after
successfull checkout. I want the user to be taken to the signup page immediatly. Not wait for
and email. This will cause us plently of support headaches, as i have experince in my market.

Also, how does it verify that it was a successfull payment, so that the use can create an account
I do not see any custom DB tables that would store this info. Can you please advise how this
process works so i can code the solutions I need here

3) Thanks!

4&5) These are both recurring. Now say the user buys the First Recurring product. He will be sent to
an upsell where we will offer another recurring upgrade. The way it is now. This will make the user
go through the clickbank checkout proccess twice, and create 2 subscriptions. Which is fine
however I was talking to a former clickbank employee about the upsell process. All they do is
store the payment data for that session internally, and then when the user clicks the upsell button
it simply rebills the user and then it goes to the thank you page. I dont know all the variables yet
but this would be cool if s2 would keep this in mind on a future release.


Posted: Thursday Jul 5th, 2012 at 11:51 am #18396

Hey Ignore the email i just sent to your support form, It started working once I changed it to 2.1 :)

Now few things here, i guess i’m confused with the process

1) &s2member_pro_clickbank_return_success=http://…

Does not redirect to the URL – instead it puts it inside a Click This Button

I need to bypass this page.

2) I see that it sends out an email from s2 with a link to create an account after purchase
how do i view users that are pending registration but did not signup yet?

3) Where do i modify the create account form (were using Buddy Press)

4) I have an upsell after the 1st clickbank purchase (which is a level 2 upgrade)
so if they buy the upgrade and go through the clickbank checkout again. Will s2 upgrade
the account?

5) Is there a way i can use clickbanks 1click Upsell here?


Posted: Tuesday Jul 3rd, 2012 at 6:27 pm #18230

Ok more to add that may help. It seems that it the POST vars are verified but then it SAYS the
API keys are not configured properly. However the account is still test mode – so would that matter
on the API keys?

array (
0 => ‘Return-Data received on: Wed Jul 4, 2012 12:12:43 am CEST’,
1 => ‘s2Member POST vars verified with ClickBank®.’,
2 => ‘Sleeping for 5 seconds. Giving ClickBank® a chance to finalize processing.’,
3 => ‘Awake. It\’s Wed Jul 4, 2012 12:12:48 am CEST. Processing will continue.’,
4 => ‘Unable to obtain API vars. The ClickBank® API may NOT have data for this order yet. Or, your ClickBank® API Keys are NOT configured properly under `s2Member -> ClickBank® Options`.’,
5 => ‘array (
\’s2member_pro_clickbank_return\’ => \’1\’,
\’s2member_pro_clickbank_return_success\’ => \’\’,
\’item\’ => \’1\’,
\’cbreceipt\’ => \’KMHREJ7Q\’,
\’time\’ => \’1341353355\’,
\’cbpop\’ => \’46206500\’,
\’cbaffi\’ => \’0\’,
\’cname\’ => \’JvWith Ricky\’,
\’cemail\’ => \’\’,
\’ccountry\’ => \’US\’,
\’czip\’ => \’07731\’,
\’s2_invoice\’ => \’1\’,
\’s2_p1\’ => \’0 D\’,
\’s2_p3\’ => \’1 M\’,
\’s2_desc\’ => \’MasterMind Members / description and pricing details here.\’,
\’s2_custom\’ => \’\’,
\’s2_customer_ip\’ => \’96.57.136.xx\’,
\’s2_subscr_id\’ => \’s2-4ff36d89b7021\’,
\’_s2member_sig\’ => \’1341353353-6fe4c174e9a2a4de53cfc5c52688a7ad\’,
6 => ‘Return-Data reformulated. Piping through s2Member\’s core/standard PayPal® processor with `proxy_use` ( `ty-email` ).’,
7 => ‘Please check PayPal® RTN logs for further processing details.’,
8 => ‘;,

Posted: Tuesday Jul 3rd, 2012 at 6:21 pm #18229

OK issues here – besides the one above – The IPN is not creating the account
Here is the LOG

PHP v5.3.10 :: WordPress® v3.4.1 :: s2Member® v120622 :: s2Member® Pro v120622
Memory 29.61 MB :: Real Memory 30.25 MB :: Peak Memory 29.69 MB :: Real Peak Memory 30.25 MB
User-Agent: Jakarta Commons-HttpClient/3.1
array (
‘s2member_log’ =>
array (
0 => ‘Unable to verify POST vars. This is most likely related to an invalid ClickBank® configuration. Please check: s2Member -> ClickBank® Options.’,
1 => ‘If you\’re absolutely SURE that your ClickBank® configuration is valid, you may want to run some tests on your server, just to be sure $_POST variables are populated, and that your server is able to connect to ClickBank® over an HTTPS connection.’,
2 => ‘s2Member uses the WP_Http class for remote connections; which will try to use cURL first, and then fall back on the FOPEN method when cURL is not available. On a Windows® server, you may have to disable your cURL extension. Instead, set allow_url_fopen = yes in your php.ini file. The cURL extension (usually) does NOT support SSL connections on a Windows® server.’,
3 => ‘array (
\’s2member_pro_clickbank_notify\’ => \’1\’,
\’ctransamount\’ => \’8872\’,
\’cprodtitle\’ => \’Mastermind – VIP Inner Circle Membership\’,
\’ctranspaymentmethod\’ => \’TEST\’,
\’cverify\’ => \’6914AFAD\’,
\’ccustemail\’ => \’\’,
\’cprodtype\’ => \’RECURRING\’,
\’ctransaffiliate\’ => \’\’,
\’ccustcc\’ => \’US\’,
\’ctransreceipt\’ => \’KMHREJ9Q\’,
\’ccustname\’ => \’JvWith Ricky\’,
\’cvendthru\’ => \’s2_p3=1+M&s2_p1=0+D&s2member_pro_clickbank_return=1&s2_subscr_id=s2-4ff36e081c013&\’,
\’caffitid\’ => \’\’,
\’ctransaction\’ => \’TEST_SALE\’,
\’ccuststate\’ => \’NJ\’,
\’ctranstime\’ => \’1341353518\’,
\’ctranspublisher\’ => \’sixfigmax\’,
\’cproditem\’ => \’2\’,

Ok what this is telling me here is that the POST vars are not being read or inserted. Obviously the IPN is working
as the LOG is being created. Also I checked everything.. $_POST is working and the clickbank configuration is valid

Need some help on this one here


Posted: Tuesday Jul 3rd, 2012 at 5:39 pm #18225

Ok just incase anybody is banging there head on this one here I figured it out
Just make a external file in your WP install that sits in the same DIR as wp-load.php
say the file name is (clickbank.php)

include_once "wp-load.php";
function handle_custom_clickbank_redirections()
			$clickbank_checkout = do_shortcode('[s2Member-Pro-ClickBank-Button ... output="url" /]');
			$clickbank_checkout = do_shortcode('[s2Member-Pro-ClickBank-Button ... output="url" /]');
		wp_redirect($clickbank_checkout); exit;

do then you would just access like this

(assumes /members/ has your WP installation)

Where Type would control the IF statement as to which shortcode to execute
So basiclly you would generate your clickbank shortcodes inside of s2
and the important thing to change is output=”anchor” to output=”url
or the redirect will fail!!

Now you can simply link any sales button OUTSIDE of wordpress or s2 with the links
above ;)


Posted: Tuesday Jul 3rd, 2012 at 4:21 pm #18221

Hi I found the shot code that generated the clickbank buy button. I need to get that shoertcode output outside of WORDPRESS totally. So i would have to mimick the what s2 is currently doing.. what concerns me here is the invoice and signature variables. Can I please get someone to help me understand what needs to be passed to clickbank in order to have a successful s2 member level transaction.


Posted: Tuesday Jul 3rd, 2012 at 12:25 pm #18198

Awesome dude, i kindof figured that out last night :)


Posted: Tuesday Jul 3rd, 2012 at 12:18 pm #18195

Awesome dude! Thanks!

Viewing 22 replies - 26 through 47 (of 47 total)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.