main->wpstream_live_connection->wpstream_get_live_event_for_user($with_exit); // Cache the live event data in a transient for 10 minutes. set_transient('wpstream_bb_get_live_event_for_user', $live_event_for_user, 600); } // Return the live event data for the logged-in user. return $live_event_for_user; } if ( ! function_exists('wpstream_get_live_tag_html' ) ) { /** * Check if a product is live and return the live tag HTML if applicable. * * @param int $post_id The ID of the post. * @return string The HTML for the live tag or an empty string. */ function wpstream_get_live_tag_html($post_id) { if ((get_post_type($post_id) === 'product' && has_term('live_stream', 'product_type', $post_id)) || get_post_type($post_id) === 'wpstream_product') { $live_events = wpestream_integrations_get_current_user_live_events('no'); if (is_array($live_events) && array_key_exists($post_id, $live_events)) { return ''; } } return ''; } } ?>