Registered Users
This snippet allows you to show the amount of users that have registered on your site to bid for the auction/s. This works best ONLY if you have enabled the option to allow only registered users to bid.
<?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); ?>
<p>There are <?php echo $users; ?> users bidding on this auction.</p>
This code MUST be entered in a custom Page template/sidebar.php where you would like to show this information. Entering it in the single.php or page.php template will show the data on all of your single Posts and Pages.
Auctions Online
This snippet shows how many current auctions you have.
<?php $table_name = $wpdb->prefix . "wpa_auctions"; $strSQL = mysql_query("SELECT COUNT(*) FROM $table_name WHERE '".current_time('mysql',"1")."' < date_end") or die(mysql_error()); list($number) = mysql_fetch_row($strSQL); ?>
<p>There are <?php echo $number; ?> auctions online.</p>
This code MUST be entered in a custom Page template/sidebar.php where you would like to show this information. Entering it in the single.php or page.php template will show the data on all of your single Posts and Pages.
Total Bid Value
The below snippet shows the total amount of bids placed on your current and closed auctions.
<?php $query = mysql_query("SELECT SUM(current_price) as sum_total FROM $table_name") or die(mysql_error()); $row = mysql_fetch_object($query); ?>
<p>Total amount of bids placed: <?php echo $row->sum_total; ?></p>
This code MUST be entered in a custom Page template/sidebar.php where you would like to show this information. Entering it in the single.php or page.php template will show the data on all of your single Posts and Pages.