• Roundup WP
  • Products
    • Registrations for the Events Calendar Pro – WordPress Event Registration
      • Buy Now
      • Setup (Pro)
      • Demo
    • Stripe Extension
      • Buy Now
      • Setup
    • Mailchimp Extension
      • Buy Now
      • Setup
    • RTEC Memberships
      • Getting Started
    • RTEC WooCommerce Payments
    • Mollie (iDEAL) Extension
      • Buy Now
      • Setup
    • Discount Codes Extension
      • Buy Now
      • Setup
  • Pricing
  • Features
    • Payments
    • Form Builder
    • Email Messages
    • Registration Management
    • Memberships
    • Event Specific
  • Blog
  • Support
    • FAQs and Troubleshooting
    • Codex
    • Contact Support
  • My Account
  • Get Started

Filter: rtec_email_templating

Last updated on August 9, 2017

rtec_email_templating is a filter for adding or altering the email templating text. Enter the template and what the template represents as a key value pair. It accepts two parameters, the existing template text in an associative array, $search_replace, and submission data based on the context of the email, $sanitized_data.

Usage

<?php add_filter( 'rtec_email_templating', 'function_name' ); ?>

Parameters

$search_replace – (array) Array of find and replace text in key, value pairs. “Key” is the template text (i.e. {first}), “value” is the dynamic replacement text (i.e. John).
$sanitized_data – (array) Associative array of event and registration data related to the email being sent.

Changelog

Pro
1.2 – introduced

Free
2.0 – introduced

Example: Add the registration count as a template

function ru_add_email_template( $search_replace, $sanitized_data ) {

	$event_id = isset( $sanitized_data['event_id'] ) ? $sanitized_data['event_id'] : false;

	if ( false !== $event_id ) {
		$event_meta = rtec_get_event_meta( $event_id );
// add one to include the form submitter if this is for a notification email sent after the form submits
		$num_registered = $event_meta['num_registered'] + 1;

		$search_replace['{registration-count}'] = $num_registered;
	}

	return $search_replace;
}
add_filter( 'rtec_email_templating', 'ru_add_email_template', 10, 2 );

Example: Add the event cost as {event-cost}

function ru_add_email_template( $search_replace, $sanitized_data ) {
    $event_id = isset( $sanitized_data['event_id'] ) ? $sanitized_data['event_id'] : false;

    if ( function_exists( 'tribe_get_cost' ) && false !== $event_id ) {
        $event_cost = tribe_get_cost( $event_id, false );
        $search_replace['{event-cost}'] = $event_cost;
    }

    return $search_replace;
}
add_filter( 'rtec_email_templating', 'ru_add_email_template', 10, 2 );

Example: Add individual date templates for start date, start time, end date, and end time

function ru_add_individual_date_template( $search_replace, $sanitized_data ) {
	
	$event_id = isset( $sanitized_data['event_id'] ) ? $sanitized_data['event_id'] : false;

	if ( false !== $event_id ) {
		if ( is_callable( 'tribe_get_start_date' ) && is_callable( 'tribe_get_end_date' ) ) {
			$time_format = rtec_get_time_format();

			$start_date = tribe_get_start_date( $event_id, false );
			$start_time = tribe_get_start_date( $event_id, false, $time_format );
			$end_date   = tribe_get_end_date( $event_id, false );
			$end_time   = tribe_get_end_date( $event_id, false, $time_format );

			$search_replace['{start-date}'] = $start_date;
			$search_replace['{start-time}'] = $start_time;
			$search_replace['{end-date}']   = $end_date;
			$search_replace['{end-time}']   = $end_time;
		}
	}

	return $search_replace;
}
add_filter( 'rtec_email_templating', 'ru_add_individual_date_template', 10, 2 );

Example: Create an email template using the label for each custom field created with Events Calendar Pro i.e. {Custom Field Label}

function ru_events_pro_fields( $search_replace, $sanitized_data ) {

	$event_id = isset( $sanitized_data['event_id'] ) ? $sanitized_data['event_id'] : false;

	if ( false !== $event_id ) {
		$meta = get_post_meta( $event_id );
		$tribe_custom_fields = tribe_get_option( 'custom-fields', false );

		foreach ( $tribe_custom_fields as $custom_field ) {
			if ( isset( $meta[ $custom_field['name'] ] ) ) {
				$search_replace[ '{' . $custom_field['label'] . '}' ] = $meta[ $custom_field['name'] ][0];
			}
		}

	}

	return $search_replace;
}
add_filter( 'rtec_email_templating', 'ru_events_pro_fields', 10, 2 );
Company
  • About
  • Contact
  • Careers
Products
  • Registrations for the Events Calendar
  • Stripe Payments (extension)
  • Mailchimp Email Lists (extension)
  • Event Memberships (extension)
  • WooCommerce Payments (extension)
  • Mollie iDEAL Payments (extension)
  • Discount Codes (extension)
Features
  • Form Builder
  • Event Registration Payments
  • Membership Features
  • Email Messaging
  • Registration Management
  • Event Specific
Resources
  • Support
  • My Account
  • Documentation
  • Pricing
  • Blog
Connect with Us
Follow us on Facebook Contact Us
Copyright © 2025 Roundup WP LLC
Terms & Conditions Privacy Policy Roundup WP Coupon Codes