Need help with php on my auction site!
Moderator: General Moderators
Need help with php on my auction site!
Hello. I am fairly new at PHP coding. But I am looking to implement a function to my auction site. As of now the site wont allow multi item auctions, and i would like to insert a field for selling multiple auctions up to 999 items. Anyone know what codes to use? It is a wordpress site. Help please! 
Re: Need help with php on my auction site!
no tips? anyone?
Re: Need help with php on my auction site!
What are you starting with? What does your existing code look like? It's going to be difficult to suggest meaningful approaches without first seeing that.
Re: Need help with php on my auction site!
Code: Select all
<?php
wp_enqueue_media();
$post_id;
$logged_user_id = wp_get_current_user(); //get user id
$logged_user_role = $logged_user_id->roles; //get user role
$currency_code = substr(get_option('wdm_currency'), -3);
$check_fees_stat = get_option('wdm_manage_status_data');
$amt = get_option('wdm_manage_fees_data');
$can_add_directly = false;
if( in_array('administrator', $logged_user_role) || $check_fees_stat === 'Inactive' || $amt <=0)
{
$can_add_directly = true;
}
if(!empty($_POST)){
if(isset($_POST['ua_wdm_add_auc']) && wp_verify_nonce($_POST['ua_wdm_add_auc'],'ua_wp_n_f')){
$auction_title=(!empty($_POST["auction_title"])) ? ($_POST["auction_title"]):'';
$auction_content=(!empty($_POST["auction_description"])) ? ($_POST["auction_description"]):'';
$auction_excerpt=(!empty($_POST["auction_excerpt"])) ? ($_POST["auction_excerpt"]):'';
$auc_end_tm = isset($_POST["end_date"]) ? strtotime($_POST["end_date"]) : 0;
$blog_curr_tm = strtotime(date("Y-m-d H:i:s", time()));
if($can_add_directly)
$auction_stat = 'publish';
else
$auction_stat = 'draft';
if(($auc_end_tm > $blog_curr_tm) && $auction_title!="" && $auction_content!=""){
global $post_id;
$is_update=false;
$reactivate=false;
//update auction mode
if(isset($_POST["update_auction"]) && !empty($_POST["update_auction"]) && !isset($_GET["reactivate"])){
$post_id=$_POST["update_auction"];
$args=array(
'ID' => $post_id,
'post_title' => $auction_title,
'post_content' => $auction_content,
'post_excerpt' => $auction_excerpt
);
wp_update_post( $args );
$is_update = true;
}
//reactivate auction mode
elseif(isset($_POST["update_auction"]) && !empty($_POST["update_auction"]) && isset($_GET["reactivate"]))
{
$args = array(
'post_title' => wp_strip_all_tags( $auction_title ),//except for title all other fields are sanitized by wordpress
'post_content' => $auction_content,
'post_type' => 'ultimate-auction',
'post_status' => $auction_stat,
'post_excerpt' => $auction_excerpt
);
$post_id = wp_insert_post($args);
$this->wdm_set_auction($post_id);
$this->auction_id=$post_id;
$reactivate = true;
}
//create/add auction mode
else{
$args = array(
'post_title' => wp_strip_all_tags( $auction_title ),//except for title all other fields are sanitized by wordpress
'post_content' => $auction_content,
'post_type' => 'ultimate-auction',
'post_status' => $auction_stat,
'post_excerpt' => $auction_excerpt
);
$post_id = wp_insert_post($args);
$this->wdm_set_auction($post_id);
$this->auction_id=$post_id;
}
if($post_id){
$get_default_timezone = get_option('wdm_time_zone');
if(!empty($get_default_timezone))
{
date_default_timezone_set($get_default_timezone);
}
echo '<div id="message" class="updated fade">';
echo "<p><strong>";
if($is_update){
if($can_add_directly){
_e("Auction updated successfully.", "wdm-ultimate-auction");
}
else{
$listing_fee = get_post_meta($post_id, 'wdm_auction_listing_fees', true);
if($listing_fee === 'Paid' || (isset($_GET['edit_auction']) && !empty($_GET['edit_auction']) && !isset($_GET["reactivate"]))){
_e("Auction updated successfully.", "wdm-ultimate-auction");
}
else{
echo wdm_auction_listing_charge($post_id, $auction_title, $amt, $currency_code, 'be');
}
}
}
elseif($reactivate)
{
update_post_meta($post_id, 'wdm-auth-key',md5(time().rand()));
if(isset($_POST["start_date"]) && !empty($_POST["start_date"]))
add_post_meta($post_id, 'wdm_creation_time', date($_POST["start_date"]));
else
add_post_meta($post_id, 'wdm_creation_time', date("Y-m-d H:i:s", time()));
if($can_add_directly){
printf(__("Auction reactivated successfully. Auction id is %d", "wdm-ultimate-auction"), $post_id);
}
else{
echo wdm_auction_listing_charge($post_id, $auction_title, $amt, $currency_code, 'be');
}
}
else
{
update_post_meta($post_id, 'wdm-auth-key',md5(time().rand()));
if(isset($_POST["start_date"]) && !empty($_POST["start_date"]))
add_post_meta($post_id, 'wdm_creation_time', date($_POST["start_date"]));
else
add_post_meta($post_id, 'wdm_creation_time', date("Y-m-d H:i:s", time()));
if($can_add_directly){
printf(__("Auction created successfully. Auction id is %d", "wdm-ultimate-auction"), $post_id);
}
else{
echo wdm_auction_listing_charge($post_id, $auction_title, $amt, $currency_code, 'be');
}
}
echo "</strong></p></div>";
if(isset($_POST["start_date"]) && !empty($_POST["start_date"])){
$temp = term_exists('scheduled', 'auction-status');
wp_set_post_terms($post_id, $temp["term_id"], 'auction-status');
update_post_meta($post_id, 'wdm_creation_time', date($_POST["start_date"]));
}
else{
$temp = term_exists('live', 'auction-status');
wp_set_post_terms($post_id, $temp["term_id"], 'auction-status');
}
update_post_meta($post_id, 'wdm_product_image_gallery',$_POST["product_image_gallery"]);
//update options
for($u=1; $u<=4; $u++)
{
update_post_meta($post_id, "wdm-image-".$u,$_POST["auction_image_".$u]);
}
$other_imgs = get_post_meta($post_id, 'wdm_product_image_gallery', true);
$oimg = explode(',', $other_imgs);
foreach($oimg as $oi){
$uinc = $u++;
$s_img = wp_get_attachment_url( $oi );
update_post_meta($post_id, "wdm-image-".$uinc, $s_img);
if(isset($_POST['auction_main_image']) && ($_POST['auction_main_image'] == 'main_image_'.$uinc))
update_post_meta($post_id, 'wdm_auction_thumb', $s_img);
}
$openingBid = $_POST["opening_bid"];
$lowestBid = $_POST["lowest_bid"];
$incValue = $_POST["incremental_value"];
if(!in_array('administrator', $logged_user_role)){
if(isset($_GET['edit_auction']) && !empty($_GET['edit_auction']) && !isset($_GET["reactivate"])){
$openingBid = get_post_meta($post_id, 'wdm_opening_bid', true);
$lowestBid = get_post_meta($post_id, 'wdm_lowest_bid', true);
$incValue = get_post_meta($post_id, 'wdm_incremental_val', true);
}
}
/* wdm */
update_post_meta($post_id, 'wdm-main-image',$_POST["auction_main_image"]);
update_post_meta($post_id, 'wdm_listing_starts', $_POST["start_date"]);
update_post_meta($post_id, 'wdm_listing_ends', $_POST["end_date"]);
update_post_meta($post_id, 'wdm_opening_bid', round($openingBid, 2));
update_post_meta($post_id, 'wdm_lowest_bid', round($lowestBid, 2));
update_post_meta($post_id, 'wdm_incremental_val', round($incValue, 2));
update_post_meta($post_id, 'wdm_buy_it_now', round($_POST["buy_it_now_price"], 2));
update_post_meta($post_id, 'wdm_payment_method', $_POST["payment_method"]);
//if another bidding engine is active
update_post_meta($post_id, 'wdm_bidding_engine', $_POST["bidding_engine"]);
for($im=1; $im<=4; $im++)
{
if(get_post_meta($post_id,'wdm-main-image',true) == 'main_image_'.$im)
{
$main_image = get_post_meta($post_id,'wdm-image-'.$im,true);
update_post_meta($post_id, 'wdm_auction_thumb', $main_image);
}
}
}
}
elseif($auc_end_tm <= $blog_curr_tm)
{
?> <div id="message" class="error">
<p><strong><?php _e("Please enter a future date/time.", "wdm-ultimate-auction");?></strong></p>
</div>
<?php
}
else{
?>
<div id="message" class="error"><p><strong><?php _e("Auction title and Auction description cannot be left blank.", "wdm-ultimate-auction");?></strong></p></div>
<?php
}
}
else{
die(__('Sorry, your nonce did not verify.', 'wdm-ultimate-auction'));
}
}
if(!in_array('administrator', $logged_user_role)){
if(isset($_GET["edit_auction"]) && !empty($_GET["edit_auction"])){
$auc_id = $_GET["edit_auction"];
$auc_post = get_post($auc_id);
$auc_auth = $auc_post->post_author;
$auth_id = get_current_user_id();
if($auc_auth != $auth_id)
{
wp_die(__('You do not have sufficient permissions to access this page.', 'wdm-ultimate-auction'));
}
}
}
$wdm_post=$this->wdm_get_post();
if(current_user_can('add_ultimate_auction') && !current_user_can('administrator')){
$comm_act = get_option('wdm_manage_comm_invoice');
if($comm_act == 'Yes'){
$com_type = get_option('wdm_manage_comm_type');
$com_fee = get_option('wdm_manage_cm_fees_data');
$currency_code = substr(get_option('wdm_currency'), -3);
$charge = "";
if( $com_type == 'Percentage' ){
$charge = $com_fee.'%';
}
else{
$charge = $currency_code." ".$com_fee;
}
echo '<div class="error below-h2" style="padding:10px 5px;font-weight:bold;">';
printf(__("NOTE: Admin will charge %s fee as commission on final bidding amount/Buy now amount for this auction.", "wdm-ultimate-auction"), $charge);
echo '</div>';
}
}
?>
<!--form to add/update an auction-->
<form id="wdm-add-auction-form" class="auction_settings_section_style" action="" method="POST">
<?php
if($wdm_post["title"]!="")
echo "<h3>".__("Update Auction", "wdm-ultimate-auction")."</h3>";
else
echo "<h3>".__("Add New Auction", "wdm-ultimate-auction")."</h3>";
?>
<table class="form-table">
<?php
$after_thumb = "";
$bidding_engine = array();
$bidding_engine = apply_filters('ua_add_bidding_engine', $bidding_engine);
if(!empty($bidding_engine)){
$after_thumb = '<tr valign="top">
<th scope="row">
<label for="bidding_engine">'.__("Bidding Engine", "wdm-ultimate-auction").'</label>
</th>
<td>
<select id="bidding_engine" name="bidding_engine">
<option value="">'.__("Simple Bidding", "wdm-ultimate-auction").'</option>';
foreach($bidding_engine as $be){
$opt = get_option("wdm_bidding_engines");
$opt_new = $this->wdm_post_meta("wdm_bidding_engine");
if((isset($_GET['edit_auction']) && !empty($_GET['edit_auction'])) || isset($post_id))
$opt = $opt_new;
$select = $opt == $be["val"] ? "selected" : "";
$after_thumb .= '<option value="'.$be["val"].'" '.$select.'>'.$be["text"].'</option>';
}
$after_thumb .= '</select>
</td>
</tr>';
}
echo $after_thumb;
?>
<tr valign="top">
<th scope="row">
<label for="auction_title"><?php _e("Product Title", "wdm-ultimate-auction");?></label>
</th>
<td>
<input name="auction_title" type="text" id="auction_title" class="regular-text" value="<?php echo $wdm_post["title"];?>"/>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="auction_description"><?php _e("Product Description", "wdm-ultimate-auction");?></label>
</th>
<td>
<!--<textarea name="auction_description" type="text" id="auction_description" cols="50" rows="10" class="large-text code"><?php echo $wdm_post["content"];?></textarea>-->
<?php
$args = array(
'media_buttons' => false,
'textarea_name' => 'auction_description',
'textarea_rows' => 10,
);
wp_editor($wdm_post["content"], 'auction_description', $args);?>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="auction_excerpt"><?php _e("Product Short Description", "wdm-ultimate-auction");?></label>
</th>
<td>
<textarea name="auction_excerpt" id="auction_excerpt" class="regular-text ua_thin_textarea_field"><?php echo $wdm_post["excerpt"];?></textarea>
<div class="ult-auc-settings-tip"><?php _e("Enter short description (excerpt) for the product. This description is shown on the auctions listing page.", "wdm-ultimate-auction");?></div>
</td>
</tr>
<?php
$after_desc = '';
$after_desc = apply_filters('wdm_ua_after_product_desc', $after_desc);
echo $after_desc;
for($p=1; $p<=4; $p++)
{
$single_img = $this->wdm_post_meta("wdm-image-".$p);
echo '<tr valign="top">
<th scope="row">
<label for="auction_image_'.$p.'">'.__("Product Image/Video", "wdm-ultimate-auction").' '.$p.'</label>
</th>
<td>
<input name="auction_image_'.$p.'" type="text" id="auction_image_'.$p.'" class="regular-text wdm_image_'.$p.'_url url" value="'.$single_img.'"/>
<input name="wdm_upload_image_'.$p.'_button" id="wdm_image_'.$p.'_url" class="button wdm_auction_image_upload" type="button" value="'.__('Select File', 'wdm-ultimate-auction').'"/>
</td>
</tr>';
}
?>
<tr valign="top">
<th scope="row">
<label for="auction_main_image"><?php _e("Thumbnail Image", "wdm-ultimate-auction");?></label>
</th>
<td>
<select id="auction_main_image" name="auction_main_image">
<?php for($m=1; $m<=4; $m++)
{
?>
<option value="main_image_<?php echo $m;?>" <?php echo $this->wdm_post_meta("wdm-main-image") == "main_image_".$m ? "selected" : "";?>><?php _e("Product Image/Video", "wdm-ultimate-auction"); echo " ".$m;?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="auction_image_gallery"><?php _e("More Images", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php
$med_up = '<div id="product_images_container">
<ul class="product_images">';
ua_wp_media_upload_show();
$product_image_gallery = $this->wdm_post_meta('wdm_product_image_gallery');
if ( $product_image_gallery ){
$attachments = explode( ',', $product_image_gallery );
foreach ( $attachments as $attachment_id ) {
$med_up .= '<li class="wdmimage" data-attachment_id="' . $attachment_id . '">
' . wp_get_attachment_image( $attachment_id, 'thumbnail' ) . '
<ul class="actions">
<li><a href="#" class="delete" title="' . __( 'Delete image', 'wdm-ultimate-auction' ) . '">' . __( 'Delete', 'wdm-ultimate-auction' ) . '</a></li>
</ul>
</li>';
}
}
$med_up .= '</ul>';
$med_up .= '<input type="hidden" id="product_image_gallery" name="product_image_gallery" value="'.esc_attr( $product_image_gallery ).'" /></div>
<p class="add_product_images hide-if-no-js">
<a href="#">'.__( "Add more images", "wdm-ultimate-auction" ).'</a>
</p>';
echo "<div id='auction_image_gallery'>".$med_up."</div>";?>
</td>
</tr>
<tr valign="top" class="standard_auction_section">
<th scope="row">
<label for="opening_bid"><?php _e("Opening Price", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php echo $currency_code;?>
<input name="opening_bid" type="text" id="opening_bid" class="small-text number ua_auction_price_fields" value="<?php echo $this->wdm_post_meta('wdm_opening_bid');?>"/>
</td>
</tr>
<tr valign="top" class="standard_auction_section">
<th scope="row">
<label for="lowest_bid"><?php _e("Lowest Price to Accept", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php echo $currency_code;?>
<input name="lowest_bid" type="text" id="lowest_bid" class="small-text number ua_auction_price_fields" value="<?php echo $this->wdm_post_meta('wdm_lowest_bid');?>"/>
<div>
<span class="ult-auc-settings-tip"><?php _e("Set Reserve price for your auction.", "wdm-ultimate-auction");?></span>
<a href="" class="auction_fields_tooltip"><strong><?php _e("?", "wdm-ultimate-auction");?></strong>
<span><?php _e("A reserve price is the lowest price at which you are willing to sell your item. If you don't want to sell your item below a certain price, you can a set a reserve price. The amount of your reserve price is not disclosed to your bidders, but they will see that your auction has a reserve price and whether or not the reserve has been met. If a bidder does not meet that price, you're not obligated to sell your item.", "wdm-ultimate-auction");?>
<br /><strong><?php _e("Why have a reserve price?", "wdm-ultimate-auction");?></strong><br />
<?php _e("Many sellers have found that too high a starting price discourages interest in their item, while an attractively low starting price makes them vulnerable to selling at an unsatisfactorily low price. A reserve price helps with this.", "wdm-ultimate-auction");?>
</span>
</a>
</div>
</td>
</tr>
<tr valign="top" class="standard_auction_section">
<th scope="row">
<label for="incremental_value"><?php _e("Incremental Value", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php echo $currency_code;?>
<input name="incremental_value" type="text" id="incremental_value" class="small-text number ua_auction_price_fields" value="<?php echo $this->wdm_post_meta('wdm_incremental_val');?>"/>
<div class="ult-auc-settings-tip"><?php _e("Set an amount from which next bid should start.", "wdm-ultimate-auction");?></div>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="start_date"><?php _e("Start Date", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php
$disb = "";
if(!empty($_GET['edit_auction'])){
$active_trm = wp_get_post_terms($_GET['edit_auction'], 'auction-status',array("fields" => "names"));
if(in_array('live',$active_trm))
$disb = "disabled='disabled'";
}
?>
<input name="start_date" type="text" id="start_date" class="regular-text" readOnly <?php echo $disb; ?> value="<?php echo $this->wdm_post_meta('wdm_listing_starts');?>"/>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="end_date"><?php _e("Ending Date", "wdm-ultimate-auction");?></label>
</th>
<td>
<input name="end_date" type="text" id="end_date" class="regular-text" readOnly value="<?php echo $this->wdm_post_meta('wdm_listing_ends');?>"/>
<?php $def_timezone = get_option('wdm_time_zone');
if(!empty($def_timezone)){
printf(__('Current blog time is %s', 'wdm-ultimate-auction'),'<strong>'.date("Y-m-d H:i:s", time()).'</strong> ');
echo __('Timezone:', 'wdm-ultimate-auction').' <strong>'.$def_timezone.'</strong>';
}
else{
if(in_array('administrator', $logged_user_role))
printf(__('Please select your Timezone at %s Tab of the plugin.', 'wdm-ultimate-auction'), '<a href="'.admin_url('admin.php?page=ultimate-auction').'">'.__('Settings', 'wdm-ultimate-auction').'</a>');
else
_e('Please contact your administrator to set Timezone for the plugin.', 'wdm-ultimate-auction');
}
?>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="buy_it_now_price"><?php _e("Buy Now Price", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php echo $currency_code;?>
<input name="buy_it_now_price" type="text" id="buy_it_now_price" class="small-text number" value="<?php echo $this->wdm_post_meta('wdm_buy_it_now');?>"/>
<div class="ult-auc-settings-tip"><?php printf(__("Visitors can buy your auction by making payments via PayPal.", "wdm-ultimate-auction"));?></div>
</td>
</tr>
<?php do_action('ua_add_shipping_cost_input_field'); //hook to add new price field
$before_pay = '';
$before_pay = apply_filters('wdm_ua_add_before_payment', $before_pay);
echo $before_pay;
?>
<tr valign="top">
<th scope="row">
<label for="payment_method"><?php _e("Payment Method", "wdm-ultimate-auction");?></label>
</th>
<td>
<?php /*$paypal_enabled = get_option('wdm_paypal_address');
$wire_enabled = get_option('wdm_wire_transfer');
$mailing_enabled = get_option('wdm_mailing_address');*/
$comm_inv = get_option('wdm_manage_comm_invoice');
$comm = false;
if($comm_inv == 'Yes' && (!in_array('administrator', $logged_user_role)) ){
$comm = true;
}
$pay_methods = array();
if(in_array('administrator', $logged_user_role))
$pay_methods = get_option('payment_options_enabled');
else
$pay_methods = get_user_meta($logged_user_id->ID, 'payment_options_enabled', true);
//$pay_methods = get_option('payment_options_enabled');
if(empty($pay_methods)){
$pay_methods = array();
echo '<div class="error">'.__("Please select a payment method on Settings page before adding an auction.", "wdm-ultimate-auction").'</div>';
}
//foreach($pay_methods as $key => $method){
?>
<!--<option id="<?php echo $key;?>" value="<?php echo $key;?>" <?php if($this->wdm_post_meta('wdm_payment_method') == $key) echo "selected"; if(empty($key) || $key == NULL) echo "disabled='disabled'";?>><?php echo $method;?></option>-->
<?php
//}
?>
<select id="payment_method" name="payment_method">
<option id="wdm_method_paypal" value="method_paypal" <?php if($this->wdm_post_meta('wdm_payment_method') == "method_paypal") echo "selected"; if(!array_key_exists("method_paypal", $pay_methods)) echo "disabled='disabled'";?>><?php _e("PayPal", "wdm-ultimate-auction");?></option>
<?php if(!$comm){?>
<option id="wdm_method_wire_transfer" value="method_wire_transfer" <?php if($this->wdm_post_meta('wdm_payment_method') == "method_wire_transfer") echo "selected"; if(!array_key_exists("method_wire_transfer", $pay_methods)) echo "disabled='disabled'";?>><?php _e("Wire Transfer", "wdm-ultimate-auction");?></option>
<option id="wdm_method_mailing" value="method_mailing" <?php if($this->wdm_post_meta('wdm_payment_method') == "method_mailing") echo "selected"; if(!array_key_exists("method_mailing", $pay_methods)) echo "disabled='disabled'";?>><?php _e("By Cheque", "wdm-ultimate-auction");?></option>
<option id="wdm_method_cash" value="method_cash" <?php if($this->wdm_post_meta('wdm_payment_method') == "method_cash") echo "selected"; if(!array_key_exists("method_cash", $pay_methods)) echo "disabled='disabled'";?>><?php _e("Cash", "wdm-ultimate-auction");?></option>
<?php }?>
</select>
<?php if($comm) {
echo "<span class='wdm-mark-red'>".__("You'll be able to choose only PayPal for getting the payment as admin has activated commissions feature.", "wdm-ultimate-auction")."</span>";
} ?>
<div class="ult-auc-settings-tip"><?php _e("Only those methods will be active which you have selected on 'Settings' page.", "wdm-ultimate-auction");?></div>
</td>
</tr>
</table>
<?php
global $post_id;
if(isset($_GET["edit_auction"]) && !empty($_GET["edit_auction"])){//user came here from manage auction table
echo "<input type='hidden' value='".$_GET["edit_auction"]."' name='update_auction'>";
}
else if($post_id != "")//user came here after clicking on submit button
echo "<input type='hidden' value='".$post_id."' name='update_auction'>";
echo wp_nonce_field('ua_wp_n_f','ua_wdm_add_auc');
if(in_array('administrator', $logged_user_role)){
submit_button(__('Save Changes', 'wdm-ultimate-auction'));
}
else{
if($can_add_directly && !isset($_GET['edit_auction']) && !isset($_GET["reactivate"])){submit_button(__('Save Changes', 'wdm-ultimate-auction'));}
elseif($can_add_directly && isset($_GET["reactivate"])){submit_button(__('Save Changes', 'wdm-ultimate-auction'));}
elseif(isset($_GET['edit_auction']) && !empty($_GET['edit_auction']) && !isset($_GET["reactivate"])) {
if(isset($_GET["tx"]) && !empty($_GET["tx"])){
$auth = get_post_meta($_GET['edit_auction'], 'wdm-auth-key', true);
if(isset($_GET["auc"]) && $_GET["auc"] === $auth){
//update_post_meta($_GET['edit_auction'], 'wdm_auction_listing_amt', $_GET['cc'].' '.$_GET['amt']);
update_post_meta($_GET['edit_auction'], 'wdm_auction_listing_fees', 'Paid');
update_post_meta($_GET['edit_auction'], 'wdm_auction_listing_transaction', $_GET["tx"]);
$args=array(
'ID' => $_GET['edit_auction'],
'post_status' => 'publish'
);
wp_update_post( $args );
printf("<script type='text/javascript'>
var cur_url = window.location.href;
if(window.location.href.indexOf('ua_reloaded') == -1)
setTimeout(function() {alert('".__('Auction created successfully. Auction id is %d', 'wdm-ultimate-auction')."');window.location.href=cur_url+'&ua_reloaded';}, 1000);
</script>", $_GET['edit_auction']);
}
}
echo "<script type='text/javascript'>
jQuery(document).ready(function(){
jQuery('.ua_auction_price_fields').attr('readOnly','readOnly');
jQuery('.ua_auction_price_fields').each(function(){
var num = jQuery(this).val();
jQuery(this).val(num); });
});
</script>";
submit_button(__('Save Changes', 'wdm-ultimate-auction'));
}
else{
?>
<div class="error fade">
<p><?php _e("PLEASE NOTE: You won't be able to change these fields when auction is added - ", "wdm-ultimate-auction");
echo " <strong>".__("Opening Price", "wdm-ultimate-auction")."</strong>";
echo ", ";
echo "<strong>".__("Lowest Price to Accept", "wdm-ultimate-auction")."</strong>";
echo ", ";
echo "<strong>".__("Incremental Value", "wdm-ultimate-auction")."</strong>";
?>
</p>
</div>
<p>
<input type="submit" id="ua-show-payment-btn" class="button-primary" value="<?php _e('Continue with Payment', 'wdm-ultimate-auction'); echo ' ['.$currency_code.' '.$amt.']';?>" />
<span class="wdm-listing-charge-text wdm-mark-hover">[<?php printf(__("We charge %s as auction listing fee","wdm-ultimate-auction"),$currency_code." ".$amt);?>]</span>
</p>
<?php
}
}
?>
</form>
<?php require_once('validate-auctions.php');?>Is the code for adding auctions