【发布时间】:2016-11-19 01:08:03
【问题描述】:
我在github上找到了以下sn-p:
https://gist.github.com/supercleanse/8010675
if(is_plugin_active('memberpress/memberpress.php')) {
add_action( 'user_register', 'mp_auto_enroll' );
//add_action( 'gform_user_registered', 'mp_auto_enroll', 10, 4 );
function mp_auto_enroll($user_id, $user_config=array(), $entry='', $user_pass='') {
$txn = new MeprTransaction();
$txn->user_id = $user_id;
$txn->product_id = 8; // TODO: Make sure you change this value to whatever the product_id will be
$txn->trans_num = uniqid();
$txn->status = MeprTransaction::$complete_str;
$txn->gateway = MeprTransaction::$free_gateway_str;
$txn->expires_at = 0; // 0 = Lifetime, null = product default expiration
$txn->store();
}
}
以上代码只添加了非循环交易,如何添加循环交易
我尝试添加
$txn->amount = 100;
$txn->period_type="month";
它不起作用,请提供任何线索
【问题讨论】:
-
@supercleanse 任何想法,我看到你也在 stackoverflow 中
标签: wordpress membership recurring-billing