我使用此代码向付费会员专业插件中的用户发送凭证:
https://gist.github.com/strangerstudios/5331923
结帐时,我使用PayPal Express并通过支票付款;
我修改了此代码,因为我在结帐时只向PayPal用户发送凭据。在我的代码中,它似乎无法识别网关PayPal。
function my_generate_passwords() {
//Get primary gateway
$setting_gateway = get_option("pmpro_gateway");
if (!empty($_REQUEST['username']) && empty($_REQUEST['password']) && $setting_gateway == "paypalexpress") { //if paypalexpress
$_REQUEST['password'] = pmpro_getDiscountCode() . pmpro_getDiscountCode(); //using two random discount codes if paypalexpress
$_REQUEST['password2'] = $_REQUEST['password'];
}
// If pay by check ... I try to insert else to see if the system do the switch condition
else {
$_REQUEST['password'] = pmpro_getDiscountCode(); //using one random discount codes if paybycheck
$_REQUEST['password2'] = $_REQUEST['password'];
}
}
add_action("init", "my_generate_passwords");
我错了吗?