add_action( 'wp', 'custom_add_shortcodes' ); function custom_add_shortcodes() { add_shortcode( 'custom_auctions_recent_bids', 'custom_auctions_recent_bids' ); } function custom_auctions_recent_bids( $atts ) { global $wpdb; extract( shortcode_atts( array( 'limit' => 20, 'show_usernames' => 'yes', ), $atts ) ); $user_id = get_current_user_id(); $auction_activity = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'simple_auction_log ORDER BY date DESC limit %d ', $limit ) ); if ( $auction_activity ) { echo '
| ' . esc_html__( 'Date', 'wc_simple_auctions' ) . ' | '; echo '' . esc_html__( 'Auction', 'wc_simple_auctions' ) . ' | '; if ( 'yes' === $show_usernames ) { echo '' . esc_html__( 'Username', 'wc_simple_auctions' ) . ' | '; } echo '' . esc_html__( 'Bid', 'wc_simple_auctions' ) . ' | '; echo '' . esc_html__( 'Status', 'wc_simple_auctions' ) . ' | '; echo '
|---|---|---|---|---|
| ' . esc_html( date_i18n( get_option( 'date_format' ), strtotime( $value->date ) ) . ' ' . date_i18n( get_option( 'time_format' ), strtotime( $value->date ) ) ) . ' | '; echo '' . esc_html( get_the_title( $value->auction_id ) ) . ' | '; if ( 'yes' === $show_usernames ) { echo ''; $userdata = get_userdata( $value->userid ); if ( $userdata ) { echo esc_attr( $userdata->user_nicename ); } else { esc_html_e( 'n/a', 'wc_simple_auctions' ); } echo ' | '; } echo '' . wc_price( $value->bid ) . ' | '; echo '' . $product->get_price_html() . ' | '; echo '
' . esc_html__( 'There is not any bids at the moment!.', 'wc_simple_auctions' ) . '