У меня есть следующий код:
function paypalpayment() {
global $wpdb;
$user = wp_get_current_user();
$user_ID = $user->ID;
$shortcode = $wpdb->get_row("SELECT MAX(ap.pending) AS pending, ap.book_datetime, ap.id, ap.hash FROM ea_appointments AS ap "
."INNER JOIN ea_users AS us ON ap.id_users_customer = us.id "
."WHERE us.wp_id ='".$user_ID."'");
$html = '';
if ($shortcode->pending == ''){
$html .= '<h1>Processing Error: Appointment has been deleted. </h1>';
$html .= '<p align="center"><a class="fep-button" style="width: 195px; text-align: center;" href="https://lectiotutoring.co.za/EasyBlue" /> Schedule an appointment</a></p>';
} else {
$html .= '<h2>Fee Policy</h2>';
$html .= '<p>You may reschedule an appointment without charge within 24 hours of your appointment. Cancelation of an appointment within 24 hours can either result in a refund or a credit for your next appointment per your request. You will need to inform Lectio on the discussion board about how you would like your cancelation to be handled. If you would like a refund, refunds will be the full amount of the cost of your session minus the PayPal processing fees. There are no refunds for cancelations later than 24 hours in advance. <span class="bigger"><b>If payment is not completed within 10 minutes the appointment will be deleted.</b></span></p>';
$html .= '<meta http-equiv="refresh" content="';
$html .= $refreshtime;
$html .= '">';
$html .= '<style>
</style>';
$html .= '<input type="button" id="stepone" onclick="processpaypal()" value="Process Payment">';
$html .= '<div id="spinner" class="loader" style="display:none"></div>';
$html .= do_shortcode($shortcode->pending);
$html .= '<input type="button" onclick="deletapt()" value="Delete Apt.">';
$html .= '<script>
cancelurl = "https://lectiotutoring.co.za/EasyBlue/index.php/appointments/cancel/' . $shortcode->hash . '";
function deletapt(){
window.location = cancelurl;
}
$(document).ready(function() {
$("input[name=return]").val("https://lectiotutoring.co.za/payment-success/");
$("input[name=cancel_return]").val(cancelurl);
});
function processpaypal(){
$("#spinner").css("display","block");
$("#stepone").css("display","none");
setTimeout(
function()
{
$(".wpi_checkout_submit_btn").click();
}, 250);
}
</script>';
}
return $html;
}
add_shortcode("paypalpay", "paypalpayment");
//PayPal Callback function that replaces the cryptic suffix with actual service names in patients the WP-Invoice file.
function ea_paypalcallback($transaction_data){
global $wpdb;
//Grab Service Name and Date
$session_id = $transaction_data[post_data][created_by][0];
$posturl = $transaction_data[post_data][guid][0];
$urlArray = explode('=',$posturl);
$postid = $urlArray[sizeof($urlArray)-1];
$dummyname = $transaction_data[items][1][name];
$query = "SELECT concat(eas.name, ' ', DATE_FORMAT(eaa.start_datetime, '%m/%d/%Y') ) FROM ea_services AS eas " .
"LEFT JOIN ea_appointments AS eaa ON eaa.id_services = eas.id WHERE eaa.pending LIKE '%" . $session_id . "%'";
$servicename = $wpdb->get_var($query);
$wpdb->query($wpdb->prepare("UPDATE {$wpdb->prefix}posts SET post_content = REPLACE(post_content, 'Items: $dummyname', '$dummyname: $servicename') WHERE ID = $postid"));
$wpdb->query($wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = REPLACE(meta_value, '$session_id', '') WHERE meta_key = 'post_title' AND post_id = $postid"));
sleep(5);
$wpdb->query($wpdb->prepare("UPDATE ea_appointments SET pending = '' WHERE pending LIKE '%$session_id%'"));
}
Я хотел бы знать, есть ли способ подправить этот код или любой другой код, чтобы удалить пользователя, входящего в систему или входящего в систему, и сразу переходить квводя данные своей карты.Должен ли я настроить этот код или фактический код PayPal для wp-счета, чтобы удалить функцию входа в PayPal?Я хочу разрешить пользователям, не использующим PayPal, также использовать платежный шлюз.