Exemple #1
0
<?php

global $current_user;
get_currentuserinfo();
$userID = $current_user->ID;
$user_login = $current_user->user_login;
$add_link = wpestate_get_dasboard_add_listing();
$dash_profile = wpestate_get_dashboard_profile_link();
$dash_pack = get_wpestate_packages_link();
$dash_favorite = wpestate_get_dashboard_favorites();
$dash_link = wpestate_get_dashboard_link();
$dash_searches = wpestate_get_searches_link();
$dash_inbox = get_inbox_wpestate_booking();
$dash_invoice = get_invoices_wpestate();
$dash_my_bookings = wpestate_my_booking_link();
$dash_my_reservations = wpestate_my_reservations_link();
$activeprofile = '';
$activeedit = '';
$activedash = '';
$activeadd = '';
$activefav = '';
$activesearch = '';
$activemypack = '';
$activeedit = '';
$activeprice = '';
$activedetails = '';
$activeimages = '';
$activeamm = '';
$activecalendar = '';
$activemybookins = '';
$activemyreservations = '';
        update_post_meta($invoice_id, 'invoice_status', 'confirmed');
        update_post_meta($invoice_id, 'depozit_paid', $depozit / 100);
        /////////////////////////////////////////////////////////////////////////////
        // send confirmation emails
        /////////////////////////////////////////////////////////////////////////////
        wpestate_send_booking_email("bookingconfirmeduser", $user_email);
        $receiver_id = wpsestate_get_author($invoice_id);
        $receiver_email = get_the_author_meta('user_email', $receiver_id);
        $receiver_name = get_the_author_meta('user_login', $receiver_id);
        wpestate_send_booking_email("bookingconfirmed", $receiver_email);
        // add messages to inbox
        $subject = esc_html__('Booking Confirmation', 'wpestate');
        $description = esc_html__('A booking was confirmed', 'wpestate');
        wpestate_add_to_inbox($userID, $userID, $receiver_id, $subject, $description, 1);
        ////redirect catre bookng list
        $redirect = wpestate_my_reservations_link();
        wp_redirect($redirect);
        exit;
    } catch (Exception $e) {
        $error = '<div class="alert alert-danger">
                        <strong>Error!</strong> ' . $e->getMessage() . '
                    </div>';
        print $error;
    }
} else {
    if (isset($_POST['submission_pay']) && $_POST['submission_pay'] == 1) {
        ////////////////////////////////////////////////////////////////////////////////
        ////////////////// payment for submission
        ////////////////////////////////////////////////////////////////////////////////
        try {
            $token = $_POST['stripeToken'];