update_usermeta($user_ID, "first_name", $_POST['first_name']);
    update_usermeta($user_ID, "description", $_POST['description']);
    update_usermeta($user_ID, "last_name", $_POST['last_name']);
}
if (isset($_POST['deactiate']) && $_POST['deactiate'] != "") {
    $user_ID = get_current_user_id();
    //check maximum bid
    global $wpdb;
    $imfirst = false;
    $mybids = $wpdb->get_results("SELECT * FROM wp_bids where uid = {$user_ID}", "ARRAY_A");
    if ($mybids) {
        foreach ($mybids as $bid) {
            $postid = $bid['pid'];
            $soldout = get_post_meta($postid, "soldout", true);
            if ($soldout == "" || $soldout != "yes") {
                $windata = get_winner_data($postid);
                $winuser_id = $windata['uid'];
                if ($winuser_id == $user_ID) {
                    $imfirst = true;
                    break;
                }
            }
        }
    }
    //check bid offreing
    $product_sell_left = false;
    if (!$imfirst) {
        $the_query = new WP_Query(array('author' => $user_id, 'post_type' => 'auction', 'post_status' => 'publish', 'posts_per_page' => 10));
        if (count($the_query->posts) != 0) {
            if ($the_query->have_posts()) {
                while ($the_query->have_posts()) {
Example #2
0
require_once '../../../wp-load.php';
$post_id = $_POST['post_id'];
$cudate = get_post_meta($post_id, "expire_time", true);
$next_date = strtotime($cudate);
$ndd = date("Y-m-d H:i:s", $next_date);
$current_time = strtotime(date("Y-m-d H:i:s"));
$data['sold_out'] = null;
if ($next_date <= $current_time) {
    $max_price = get_maxprice($post_id);
    if ($max_price == 0) {
        $next_new_time = $next_date + 60 * 5;
        $new_date = date("Y-m-d H:i:s", $next_new_time);
        update_post_meta($post_id, "expire_time", $new_date);
    } else {
        update_post_meta($post_id, "sold_out", "yes");
        $win_data = get_winner_data($post_id);
        $win_user_id = $win_data['uid'];
        $msg = "You win product with your bid " . $win_data['price'];
        $headers = 'From: Online Auction <*****@*****.**>' . "\r\n";
        $attachments = "";
        $data['sold_out'] = 1;
        $data['winner_price'] = $win_data['price'];
        $data['winner_uid'] = $win_data['uid'];
        $data['winner_name'] = get_the_author_meta("first_name", $win_user_id) . " " . get_the_author_meta("last_name", $win_user_id);
    }
}
$data['max_bid_userid'] = 1;
$data['number_of_bids'] = get_number_of_bids($post_id);
$data['max_bid'] = get_maxprice($post_id);
$data['get_nextbid_price'] = get_nextbid_price($post_id);
$data['post_view'] = getPostViews($post_id);