PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
← All changes | src/Controllers/TemplateController.php +7 -1 4.4.3 → 4.4.5 View file →
@@ -240,9 +240,15 @@
240 240 }
241 241
242 242 public function get_template_by_name( \WP_REST_Request $request ) {
243 243 $template_name = sanitize_text_field( $request->get_param( 'template_name' ) );
244 - $template_data = $this->model::find_by_name( $template_name );
244 + $variant = yaymail_sanitize_template_variant( $request->get_param( 'variant' ) );
245 + $template_data = $this->model::find_by_name( $template_name, '', $variant );
246 + if ( '' !== $variant && empty( $template_data['id'] ) ) {
247 + // Variant posts are created on first open, seeded from the default design.
248 + new YayMailTemplate( $template_name, '', $variant );
249 + $template_data = $this->model::find_by_name( $template_name, '', $variant );
250 + }
245 251
246 252 if ( null === $template_data ) {
247 253 $all_emails = yaymail_get_emails();
248 254 if ( in_array(