Setting Up Notification Emails for The Events Calendar

Hi there and good morning!

I have installed The Events Calendar plugin from Modern Tribe on this website to use for all the weekly events that will be posted on a calendar. I have everything set up and working, accept for a registration notification to the admin when somebody signs up. Have you ever dealt with this before? Would you happen to know of a way to set this up? It is quite essential that I get this working as the client needs to know when someone signs up for a class. I have submitted on the Modern Tribe's support forum that it isn't working, but have found them to be awfully un-helpful and not very responsive (1 reply every 2 days if lucky). You guys have been very helpful and very responsive so I was hoping you might be able to help me figure this out.

All I need is to send an email to the event organizer or admin or whichever way works best just so that a notification email is sent when someone registers for an event.

Please let me know if you can help or what I can do to get this working.

Thank you and have a great day!
Mark

  • M Hipsh

    Hey Jude, I have since added a code snippet to my functions.php file. This duplicates the message the attendees get and send it to the site admin. I'm close, but still need help with a couple questions. How can I specify which admin? (there are multiple admins) or am I able to specify the email within the code snippet? I just want to be able to specify where this email get sent.

    Secondly, I've been looking in the email.php file to try and find where the subject line of the email is. I want to change this from "Your Tickets for..." to "Registration Confirmation for..."

    I have attached the email.php file, and the code snippet I added is below.

    <?php
    /**
      * BCC site admin email on all Event Tickets' RSVP ticket emails so they get a copy of it too
      *
      * From https://gist.github.com/cliffordp/4f06f95dbff364242cf54a3b5271b182
      *
      * Reference: https://developer.wordpress.org/reference/functions/wp_mail/#using-headers-to-set-from-cc-and-bcc-parameters
      *
      */
    function cliff_et_rsvp_bcc_admin_ticket() {
    	// get site admin's email
    	$bcc = sanitize_email( get_option( 'admin_email' ) );
    
    	// set Headers to Event Tickets' default
    	$headers = array( 'Content-type: text/html' );
    
    	// add BCC email if it's a valid email address
    	if ( is_email( $bcc ) ) {
    		$headers[] = sprintf( 'Bcc: %s', $bcc );
    	}
    
    	return $headers;
    }
    add_filter( 'tribe_rsvp_email_headers', 'cliff_et_rsvp_bcc_admin_ticket' );

    Let me know if you can help me figure this out please.

    Thank You Much!
    Mark

  • M Hipsh

    Well I tried attaching the email.php file anyways.. I have tried attaching it a few different ways. It didn't work.. so I tried to copy it into a text document.. word document.. errr awfully annoying that it keeps on error-ing.

    Alright I found a way to show you. I made a new support question and pasted it all in there. Hopefully this helps. - https://premium.wpmudev.org/forums/topic/disregard-this-question-please-pasting-in-a-php-file-because-it-wouldnt-attach?replies=1#post-1136560

    Let me know what you think please.

    Thank you very much, I appreciate the help!
    - Mark

  • Jude

    Hey Mark

    So sorry about the delay here ! Looks like you figured most of this out yourself.

    How can I specify which admin? (there are multiple admins) or am I able to specify the email within the code snippet? I just want to be able to specify where this email get sent.

    You should be simply able to add an email in this code as under

    function cliff_et_rsvp_bcc_admin_ticket() {
    	// get site admin's email
    	$bcc = 'admin@yoursite.com';
    
    	// set Headers to Event Tickets' default
    	$headers = array( 'Content-type: text/html' );
    
    	// add BCC email if it's a valid email address
    	if ( is_email( $bcc ) ) {
    		$headers[] = sprintf( 'Bcc: %s', $bcc );
    	}
    
    	return $headers;
    }
    add_filter( 'tribe_rsvp_email_headers', 'cliff_et_rsvp_bcc_admin_ticket' );

    Secondly, I've been looking in the email.php file to try and find where the subject line of the email is. I want to change this from "Your Tickets for..." to "Registration Confirmation for..."

    About this, here is a snippet that can help

    add_filter( 'wp_mail', 'mark_changes_the_subject' );
    
    function mark_changes_the_subject( $args ) {
    	global  $wpdb;
    
    	if ( strpos( $args['subject'] , 'Your Tickets for' ) !== false) :
    	$args['subject'] = str_replace(  'Your Tickets for' , 'Registration Confirmation for' , $args['subject'] ) ;
    
      	$args = array(
      		'to'          => $args['to'],
      		'subject'     => $args['subject'],
      		'message'     => $args['message'],
      		'headers'     => $args['headers'],
      		'attachments' => $args['attachments'],
      	);
    
    	endif ; 
    
    	return $args;
    }

    Hope that clarifies and appreciate the patience

    Cheers
    Jude

  • Jude

    Howdy M Hipsh

    Sorry about the delay, was out of action on vacation for a bit and this somehow slipped through the gaps.

    Can you slightly alter the code as under

    add_filter( 'wp_mail', 'mark_changes_the_subject' );
    
    function mark_changes_the_subject( $args ) {
    
    	if ( strpos( $args['subject'] , 'Your Tickets for' ) !== false) :
    	$subject = str_replace(  'Tickets for' , 'Registration Confirmation for' , $args['subject'] ) ;
    
      	$args = array(
      		'to'          => $args['to'],
      		'subject'     => $subject,
      		'message'     => $args['message'],
      		'headers'     => $args['headers'],
      		'attachments' => $args['attachments'],
      	);
    
    	endif ; 
    
    	return $args;
    }

    Also please put it in a mu plugin. To create an mu-plugin, go to your /wp-content/ folder via FTP, and find the folder called "mu-plugins". If there is no folder with that name, then you'll want to create one. Then, create a file inside that folder, and give the file any name you like (making sure the file as an extension of .php, e.g. example.php) and paste the code in there.

    You don't need to activate that plugin, as it will be always be automatically activated. Please be sure to add a PHP start tag at the beginning of the code if you insert this code as a mu-plugin, like this:

    <?php

    Thank you for being a WPMU DEV member and have a fantastic day!

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.