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