Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // check also https://pastebin.com/EcmuuzHM
- add_action('woocommerce_before_shop_loop_item_title', 'add_outbid_bage', 60);
- function add_outbid_bage(){
- global $product,$wpdb;
- if ( is_user_logged_in() ) {
- $auction_relisted = '';
- if($product->auction_relisted){
- $auction_relisted = ' AND date > "'. $product->auction_relisted.'"' ;
- }
- $user_id = get_current_user_id();
- $postids = array();
- $userauction = $wpdb->get_results("SELECT DISTINCT auction_id FROM ".$wpdb->prefix."simple_auction_log WHERE userid = $user_id AND auction_id = ".$product->id." ".$auction_relisted ,ARRAY_N );
- if(isset($userauction) && !empty($userauction)){
- foreach ($userauction as $auction) {
- $postids []= $auction[0];
- }
- }
- if ( $product->product_type == 'auction' && ( $user_id != $product->auction_current_bider && !$product-> auction_closed) && (in_array($product->id, $postids))) :
- echo '<span class="outbid "></span>';
- endif;
- }
- }
Add Comment
Please, Sign In to add comment