Sorry about the late reply, I lost my database a couple of days ago, I had to rebuild everything again. So the process works like this:
- I set up the buttons matching all the options
- I use _GET to obtain the option settings
- then I use do_shortcode to make the shortcode available
The only culprit I can think of is because I'm doing all of these inside a shortcode function (which is placed on the membership options page). This is my code:
- Code: Select all
function confirm_func ($atts) {
$fn = $_GET['fn'];
$email = $_GET['email'];
$domain = $_GET['domain'];
$package = $_GET['package'];
$pay = $_GET['pay'];
$oid = $_GET['oid'];
$lang = $_GET['lang'];
if ($pay == 'alipay') {
switch($package) {
case 'A':
$button = do_shortcode('[s2Member-Pro-AliPay-Button level="1" ccaps="" desc="托管套餐A" custom="example.com|" . $fn . "|" . $email . "|" . $domain . "|" . $package . "|" . $pay . "|" . $oid . "|" . $lang ra="550" rp="1" rt="Y" image="default" output="anchor" /]');
$pack = '托管套餐A';
break;
case 'B':
$button = do_shortcode('[s2Member-Pro-AliPay-Button level="1" ccaps="" desc="托管套餐B" custom="example.com|$fn|$email|$domain|$package|$pay|$oid|$lang" ra="700" rp="1" rt="Y" image="default" output="anchor" /]');
$pack = '托管套餐B';
break;
case 'C':
$button = do_shortcode('[s2Member-Pro-AliPay-Button level="1" ccaps="" desc="无限托管" custom="example.com|$fn|$email|$domain|$package|$pay|$oid|$lang" ra="999" rp="1" rt="Y" image="default" output="anchor" /]');
$pack = '无限托管';
break;
default:
$output .= '出错了!';
}
} else if ($pay == 'paypal') {
switch($package) {
case 'A':
$button = do_shortcode('[s2Member-PayPal-Button level="1" ccaps="" desc="Shared Plan A" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="example.com|$fn|$email|$domain|$package|$pay|$oid|$lang" ta="0" tp="0" tt="D" ra="65.45" rp="1" rt="Y" rr="1" rrt="" rra="1" image="default" output="button" /]');
$pack = 'Shared Plan A';
break;
case 'B':
$button = do_shortcode('[s2Member-PayPal-Button level="1" ccaps="" desc="Shared Plan B" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="example.com|$fn|$email|$domain|$package|$pay|$oid|$lang" ta="0" tp="0" tt="D" ra="87.45" rp="1" rt="Y" rr="1" rrt="" rra="1" image="default" output="button" /]');
$pack = 'Shared Plan B';
break;
case 'C':
$button = do_shortcode('[s2Member-PayPal-Button level="1" ccaps="" desc="Unlimited Hosting" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="example.com|$fn|$email|$domain|$package|$pay|$oid|$lang" ta="0" tp="0" tt="D" ra="107.25" rp="1" rt="Y" rr="1" rrt="" rra="1" image="default" output="button" /]');
$pack = 'Unlimited Hosting';
break;
default:
$output .= 'Package and Gateway Information Missing. Contact Support';
}
}
if (strpos($_SERVER['REQUEST_URI'], '/zh/') !== false) {
$output .= '<table><tbody>';
$output .= '<tr><td>用户ID</td><td>' . $oid . '</td></tr>';
$output .= '<tr><td>语言</td><td>中文</td></tr>';
$output .= '<tr><td>套餐</td><td>' . $pack . '</td></tr>';
$output .= '<tr><td>结算</td><td>' . $button . ' </td></tr>';
$output .= '</tbody></table>';
} else {
$output .= '<table><tbody>';
$output .= '<tr><td>OID</td><td>' . $oid . '</td></tr>';
$output .= '<tr><td>Language</td><td>English</td></tr>';
$output .= '<tr><td>Hosting Plan</td><td>' . $pack . '</td></tr>';
$output .= '<tr><td>Purchase</td><td>' . $button . '</td></tr>';
$output .= '</tbody></table>';
}
return $output;
}
add_shortcode('confirm', 'confirm_func');
You can see that I tried 2 approaches in putting that data into the button. One is "custom="example.com|" . $fn . "|" . $email . "|" . $domain . "|" . $package . "|" . $pay . "|" . $oid . "|" . $lang" and the other is "custom=example.com|$fn|$email|$domain|$package|$pay|$oid|$lang". Unfortunately, none of them works.
In the first approach, my button link look something like this
- Code: Select all
https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8&body=托管套餐A&extra_common_param=example.com%7C¬ify_url=http%3A%2F%2Fexample.com%2F&out_trade_no=4f201de64f3c7%7E1%3A%3A1+Y%7E1%7E120.32.3.116&partner=2088501820003753&payment_type=1&paymethod=directPay&return_url=http%3A%2F%2Fexample.com%2F%3Fs2member_pro_alipay_return%3D1&seller_email=zling%40example.com&service=create_direct_pay_by_user&show_url=http%3A%2F%2Fexample.com%2F&subject=example.com&total_fee=550&sign=0f0b6a44834ed2838ee0e98d91a2928f&sign_type=MD5
Basically, the variables aren't even included
In the second approach, all the variable turned into their literal value:
- Code: Select all
https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8&body=托管套餐B&extra_common_param=example.com%7C%24name%7C%24email%7C%24domain%7C%24package%7C%24pay%7C%24oid%7C%24lang¬ify_url=http%3A%2F%2Fexample.com%2F&out_trade_no=4f201e75977fa%7E1%3A%3A1+Y%7E1%7E120.32.3.116&partner=2088501820003753&payment_type=1&paymethod=directPay&return_url=http%3A%2F%2Fexample.com%2F%3Fs2member_pro_alipay_return%3D1&seller_email=zling%40example.com&service=create_direct_pay_by_user&show_url=http%3A%2F%2Fexample.com%2F&subject=example.com&total_fee=700&sign=1bcf9786e7ab10434384fd021a160651&sign_type=MD5