Page 1 of 1

s2Member Pro Forms ( dynamically via PHP )

PostPosted: July 18th, 2010, 12:25 am
by Jason Caldwell
Am I able to use the Paypal Pro Form in the template files?

Yes, you can build Pro Forms dynamically, using this function:
Code: Select all
echo ws_plugin__s2member_pro_paypal_form($attributes); 

Where $attributes, is an associative array containing the same attributes as the Shortcode for a Pro Form. You can generate a Shortcode for a Pro Form, under: s2Member -> PayPal Pro Forms, which will give you the attributes you need. After you do this a few times, you'll be able to bypass the Shortcode generator all together, if you prefer.

So here is a quick example:
Code: Select all
<?php

$attributes 
= array(
"level" => "1",
"ccaps " => "",
"desc" => "Description and pricing details here.",
"ps" => "paypal",
"cc" => "USD",
"custom" => "www.example.com",
"tp" => "0",
"tt" => "D",
"ra" => "0.01",
"rp" => "1",
"rt" => "M",
"rr" => "1",
"accept" => "paypal,visa,mastercard,amex,discover,maestro,solo",
"accept_via_paypal" => "paypal"
);

echo ws_plugin__s2member_pro_paypal_form($attributes);
?>

This tip has been posted for developers only.
None of this is required. The recommended method is through WordPress Shortcodes. In other words, you can skip this advanced method, by just going to: s2Member -> PayPal Pro Forms. That is the easiest way. This advanced technique is designed to maximize the flexibility of s2Member Pro for developers integrating s2Member Pro for their clients.

Re: s2Member Pro Forms ( dynamically via PHP )

PostPosted: August 7th, 2011, 6:12 pm
by ricarod
Jason great tip. Now what will be the code if using authorize.net?

I noticed given code makes some references to paypal so I would assume few differences should be set up for proforms when authorize.net, right?

Re: s2Member Pro Forms ( dynamically via PHP )

PostPosted: August 8th, 2011, 8:13 am
by ricarod
BTW I tried adding this and didn't work:

Code: Select all
<?php

$attributes 
= array(
"level" => "1",
"ccaps " => "",
"desc" => "PRODUCT DESCRIPTION.",
"ps" => "authnet",
"cc" => "USD",
"custom" => "SITE",
"tp" => "0",
"tt" => "D",
"ra" => "1.99",
"rp" => "1",
"rt" => "L",
"rr" => "BN",
"accept" => "paypal,visa,mastercard,amex,discover",
"accept_via_authnet" => "authnet"
);

echo 
ws_plugin__s2member_pro_authnet_form($attributes);
?>

Re: s2Member Pro Forms ( dynamically via PHP )

PostPosted: August 8th, 2011, 3:14 pm
by Cristián Lávaque
viewtopic.php?f=40&t=12462&src_doc_v=110710

It looks like it'd be written like this now

Code: Select all
echo c_ws_plugin__s2member_pro_authnet_form::sc_authnet_form($attributes);
 

Re: s2Member Pro Forms ( dynamically via PHP )

PostPosted: August 8th, 2011, 3:22 pm
by ricarod
Awesome! Highly impress with your effectiveness and response time once again ;)

Re: s2Member Pro Forms ( dynamically via PHP )

PostPosted: August 8th, 2011, 4:19 pm
by Cristián Lávaque
:)