Пример #1
0
 function fre_update_after_bidding($bid_id)
 {
     global $user_ID;
     if ('publish' != get_post_status($bid_id)) {
         wp_update_post(array('ID' => $bid_id, 'post_status' => 'publish'));
     }
     $project_id = get_post_field('post_parent', $bid_id);
     //update avg bids for project
     $total_bids = get_number_bids($project_id);
     $avg = get_post_meta($bid_id, 'bid_average', true);
     if ($total_bids > 0) {
         $avg = get_total_cost_bids($project_id) / $total_bids;
     }
     update_post_meta($project_id, 'bid_average', number_format($avg, 2));
     update_post_meta($project_id, 'total_bids', $total_bids);
     $this->mail->bid_mail($bid_id);
     $pay_credit = get_credit_to_pay();
     $pay_credit = -$pay_credit;
     update_credit_number($user_ID, $pay_credit);
     fre_update_user_free_bid_number();
     wp_send_json(array('success' => true, 'msg' => __('You are bid successful', ET_DOMAIN)));
 }
Пример #2
0
function cash_upproved($post_ID, $post)
{
    if (current_user_can('manage_options')) {
        if ($post->post_type == 'order' && $post->post_status == 'publish') {
            $order = new AE_Order($post_ID);
            $order_pay = $order->get_order_data();
            if (isset($order_pay['payment']) && $order_pay['payment'] == 'cash') {
                $products = $order_pay['products'];
                $sku = $order_pay['payment_package'];
                $packs = AE_Package::get_instance();
                $pack = $packs->get_pack($sku, 'bid_plan');
                if (isset($pack->et_number_posts) && (int) $pack->et_number_posts > 0) {
                    update_credit_number($post->post_author, (int) $pack->et_number_posts);
                }
            }
        }
    }
}