Beispiel #1
0
//-----------
global $current_user;
get_currentuserinfo;
global $wp_query, $wpdb;
$orderid = $wp_query->query_vars['orderid'];
$s = "select distinct * from " . $wpdb->prefix . "job_orders where id='{$orderid}'";
$r = $wpdb->get_results($s);
$row = $r[0];
$post = get_post($row->pid);
if ($row->uid == $current_user->ID) {
    $tm = time();
    $s = "update " . $wpdb->prefix . "job_orders set done_buyer='1', closed='1' where id='{$orderid}' ";
    $wpdb->query($s);
    //------------------
    $raw_amount = $row->mc_gross;
    $current_cash = PricerrTheme_get_credits($current_user->ID);
    PricerrTheme_update_credits($current_user->ID, $current_cash + $raw_amount);
    $reason = sprintf(__('Amount refunded for cancelled job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title);
    PricerrTheme_add_history_log('1', $reason, $raw_amount, $current_user->ID);
    //------------------
    $using_perm = PricerrTheme_using_permalinks();
    if ($using_perm) {
        $shp_pg_lnk = get_permalink(get_option('PricerrTheme_my_account_shopping_page_id')) . "/?";
    } else {
        $shp_pg_lnk = get_bloginfo('siteurl') . "/?page_id=" . get_option('PricerrTheme_my_account_shopping_page_id') . "&";
    }
    PricerrTheme_send_email_when_buyer_closes_the_job($orderid, $row->pid, $post->post_author, $current_user->ID);
    wp_redirect($shp_pg_lnk . "pg=cancelled");
    exit;
}
echo "oops.error";
    //--------------------
    wp_redirect(get_permalink(get_option('PricerrTheme_my_account_sales_page_id')));
    exit;
}
if (isset($_POST['confirm_force_cancellation'])) {
    $tm = current_time('timestamp', 0);
    $s = "update " . $wpdb->prefix . "job_orders set force_cancellation='1', closed='1', date_request_cancellation='{$tm}' where id='{$orderid}'";
    $wpdb->query($s);
    //-------------------
    $refund_uid = $row->uid;
    $current_cash = PricerrTheme_get_credits($refund_uid);
    PricerrTheme_update_credits($refund_uid, $current_cash + $row->mc_gross);
    $reason = sprintf(__('Payment refunded for job: <a href="%s">%s</a>', 'PricerrTheme'), get_permalink($post->ID), $post->post_title);
    PricerrTheme_add_history_log('1', $reason, $row->mc_gross, $refund_uid);
    //PricerrTheme_send_email_when_buyer_closes_the_job($orderid, $post->ID, $post->post_author, $refund_uid);
    PricerrTheme_send_email_when_buyer_closes_the_job($orderid, $post->ID, $refund_uid, $post->post_author);
    //--------------------
    wp_redirect(get_permalink(get_option('PricerrTheme_my_account_sales_page_id')));
    exit;
}
//=====================================================
$post = get_post($pid);
get_header();
?>
<div id="content">

	
    		<div class="my_box3">
            <div class="padd10">
            
            	<div class="box_title"><?php