$('#loginform').submit(function(event) {
event.preventDefault();
var url = $(this).attr('action');
var logindata = $(this).serialize();
$.ajax({
url: url,
type: 'POST',
data: logindata,
})
.done(function() {
var url = $('#loginform').attr('action');
var logindata = $('#loginform').serialize();
$.ajax({
url: url,
type: 'POST',
data: logindata,
})
.done(function() {
window.location.href = 'https://site.ru/enter';
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
})
.fail(function() {
console.log("error");
})
.always(function() {
console.log("complete");
});
});
$query = "INSERT INTO `orders` (`name`, `surname`, `phone`, `email`, `img`, `comment`) VALUES ('$name', '$sname', '$phone', '$email', '$tattoo_img', '$message')";
<form action="..." class="form">
<label for="type">
<input type="checkbox" class="check-box-one">
<input type="checkbox" class="check-box-two">
</label>
<label for="check-box-one">
<input type="checkbox" class="next">
<input type="checkbox" class="next">
</label>
<label for="check-box-two">
<input type="checkbox" class="next">
<input type="checkbox" class="next">
</label>
</form>
if ($('.check-box-one').prop('checked')){
$('.check-box-one').slideDown();
}elseif($('.check-box-two').prop('checked')){
$('.check-box-two').slideDown();
}
function s1_change_role( $order_id ) {
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item ) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
if ( $order->user_id > 0 && $product_id == '522' ) {
update_user_meta( $order->user_id, 'paying_customer', 1 );
$user = new WP_User( $order->user_id );
// Remove role
$user->remove_role( 'subscriber' );
// Add role
$user->add_role( 'Любитель' );
}
if ( $order->user_id > 0 && $product_id == '527' ) {
update_user_meta( $order->user_id, 'paying_customer', 1 );
$user = new WP_User( $order->user_id );
// Remove role
$user->remove_role( 'subscriber' );
// Add role
$user->add_role( 'Клиент' );
}
if ( $order->user_id > 0 && $product_id == '528' ) {
update_user_meta( $order->user_id, 'paying_customer', 1 );
$user = new WP_User( $order->user_id );
// Remove role
$user->remove_role( 'subscriber' );
// Add role
$user->add_role( 'VIP-Клиент' );
}
}
}
$current_user_id = get_current_user_id();
$user_info = get_userdata($current_user_id);
$massiv = $user_info->caps;
foreach($massiv as $key => $value)
{
if($key == 'Любитель'){
echo 'Роль пользователя: ';
echo substr($key, 3);
}
if($key == 'Клиент'){
echo 'Роль пользователя: ';
echo substr($key, 3);
}
if($key == 'VIP-Клиент'){
echo 'Роль пользователя: ';
echo substr($key, 3);
}
}