0
我想在用戶註冊後重定向頁面我創建了兩個單選按鈕paynow並稍後在用戶註冊中支付我想在用戶單擊paynow用戶時重定向paynow用戶應註冊並重定向到自定義的網址,如果用戶選擇付費後的用戶進行註冊,併發送自定義URL用戶對這裏未來的支付是我用如何在用戶註冊後根據單選按鈕重定向
$myemail=$_POST['email'];
$first_name="firstname";
$last_name="lastname";
echo "<script>window.location.href='https://www.payumoney.com/?firstname=$first_name&last_name=$last_name'&email=$myemail'</script>";
$to="[email protected]";
$message = "
Please payus for registering account https://www.payumoney.com/?firstname=$first_name&last_name=$last_name'&email=$email'
";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: madu<[email protected]>' . "\r\n";
$headers .= 'From: madu<[email protected]>' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
}
}
add_filter('registration_redirect', 'wpse_19692_registration_redirect');
Radio buttons
add_action('register_form', 'myplugin_register_form');
function myplugin_register_form() {
$first_name = (! empty($_POST['first_name'])) ? trim($_POST['first_name']) : '';
?>
<p>
<input type="radio" name="paystatus" id="paystatus" value="paynow">Pay Now<br>
<input type="radio" name="paystatus" id="paystatus" value="paylater">Pay Later
</p>
<?php
}
//2. Add validation. In this case, we make sure first_name is required.
add_filter('registration_errors', 'myplugin_registration_errors', 10, 3);
function myplugin_registration_errors($errors, $sanitized_user_login, $user_email) {
if (empty($_POST['first_name']) || ! empty($_POST['first_name']) && trim($_POST['first_name']) == '') {
$errors->add('first_name_error', __('<strong>ERROR</strong>: You must include a first name.', 'mydomain'));
}
return $errors;
}
//3. Finally, save our extra registration user meta.
add_action('user_register', 'myplugin_user_register');
function myplugin_user_register($user_id) {
if (! empty($_POST['paystatus'])) {
$checkme= update_user_meta($user_id, 'paystatus', trim($_POST['paystatus']));
}
}
?>
它不工作我加入WordPress的註冊字段我想爲 – maddog
重定向所以,請把你的整個代碼兩個單選按鈕。無線電錶格和所有的處理代碼。確保你分開每個代碼塊,以便更好的可讀性。我還剛剛看到,您將收音機命名爲「paystatus」...收音機的名稱將是$ _POST數組中的關鍵名稱,就像我的示例中那樣。 – xphan