Help Desk

Tickets email needs to send to customer and other email addresses.

  • Posts: 16 Topics: 10
    | Permalink

    Hello,

    I tried following instructions from this post but did not get the BCC for ticket emails to work. https://theeventscalendar.com/support/forums/topic/email-tickets-to-customer-and-another-email-address/

    The code I added is below. I did change the emails when I implemented on my site. I left out the line get_option( ‘admin_email’ ), because I don’t need it to go to the site admin. Thanks for your help.

    /**
      * BCC multiple email addresses, including the site admin email address, on all Event Tickets' RSVP ticket emails so they get a copy of it too
      *
      * From <script src="https://gist.github.com/cliffordp/c4fb2ea8fb5ca44973ff06e6facc9742.js"></script>
      * A fork of <script src="https://gist.github.com/cliffordp/4f06f95dbff364242cf54a3b5271b182.js"></script>
      * For https://theeventscalendar.com/support/forums/topic/event-tickets-free-not-plus-rsvp-notifications/#post-1272819
      *
      * @link https://developer.wordpress.org/reference/functions/wp_mail/#comment-349
      */
    function cliff_et_rsvp_bcc_admin_and_more_ticket() {
    	$bccs = array(
    	  &#039;someone@example.com&#039;, // edit or delete this line
     	  &#039;someone2@example.com&#039;, // edit or delete this line
    	);
    	
    	// set Headers to Event Tickets&#039; default
    	$headers = array( &#039;Content-type: text/html&#039; );
    	
    	// add each BCC email if it&#039;s a valid email address
    	foreach ( $bccs as $bcc ) {
    		$bcc = sanitize_email( $bcc );
    		
    		if ( is_email( $bcc ) ) {
    			$headers[] = sprintf( &#039;Bcc: %s&#039;, $bcc );
    		}
    	}
    	
    	return $headers;
    }
    add_filter( &#039;tribe_rsvp_email_headers&#039;, &#039;cliff_et_rsvp_bcc_admin_and_more_ticket&#039; );
    Posts: 16 Topics: 10
    | Permalink

    Also, I did test the code with the get_option( ‘admin_email’ ) line as instructed in the other thread and it still did not work.

    Posts: 4427 Topics: 2
    | Permalink

    Hi Ryan,

    Thanks for reaching out! Sorry to hear that snippet doesn’t want to work for your site.

    Here is a more simple version of that snippet, could you give this one a go and check if this works?

    Let me know.

    Cheers,
    Andras

    Posts: 16 Topics: 10
    | Permalink

    Hello,

    That code did not work either. My current child functions.php file is below in case you see any errors or conflicts.

    Thanks,
    Ryan

    `
    have_posts() ) {
    if ( $wp_query->get( ‘paged’ ) > 1 ) {
    // if we’re on page 1, show the selected tribe-bar-date as the first date in the range
    $first_event_date = tribe_get_start_date( $wp_query->posts[0], false );
    } else {
    //otherwise show the start date of the first event in the results
    $first_event_date = tribe_event_format_date( $_REQUEST[‘tribe-bar-date’], false );
    }
    $last_event_date = tribe_get_end_date( $wp_query->posts[ count( $wp_query->posts ) – 1 ], false );
    $title = sprintf( $title_range, $first_event_date, $last_event_date );
    } elseif ( tribe_is_past() ) {
    $title = $title_past;
    }
    // Month view title
    if ( tribe_is_month() ) {
    $title = sprintf(
    $title_month,
    date_i18n( tribe_get_option( ‘monthAndYearFormat’, ‘F Y’ ), strtotime( tribe_get_month_view_date() ) )
    );
    }
    // Day view title
    if ( tribe_is_day() ) {
    $title = sprintf(
    $title_day,
    date_i18n( tribe_get_date_format( true ), strtotime( $wp_query->get( ‘start_date’ ) ) )
    );
    }
    // All recurrences of an event
    if ( function_exists(‘tribe_is_showing_all’) && tribe_is_showing_all() ) {
    $title = sprintf( $title_all, get_the_title() );
    }
    // Week view title
    if ( function_exists(‘tribe_is_week’) && tribe_is_week() ) {
    $title = sprintf(
    $title_week,
    date_i18n( $date_format, strtotime( tribe_get_first_week_day( $wp_query->get( ‘start_date’ ) ) ) )
    );
    }
    if ( is_tax( $tribe_ecp->get_event_taxonomy() ) && $depth ) {
    $cat = get_queried_object();
    $title = ‘‘ . $title . ‘‘;
    $title .= ‘ › ‘ . $cat->name;
    }
    return $title;
    }
    add_filter( ‘tribe_get_events_title’, ‘tribe_alter_event_archive_titles’, 11, 2 );

    /*
    * Remove hover events
    */
    function add_custom_script(){
    ?>

    jQuery(window).load(function(){
    jQuery(‘img’).removeAttr(‘title’);
    });

    single_event_meta, ‘link_venue’ ) );
    }
    add_action( ‘tribe_events_single_meta_before’, ‘tribe_remove_venue_link’, 100 );

    /$/
    add_filter( ‘tribe_reverse_currency_position’, function(){ return null; } );

    /*
    * Hides QR codes from the Email/Tickets sent to purchasers
    */
    function tribe_neuter_qr () {
    if ( class_exists( ‘Tribe__Tickets_Plus__Main’ ) ) {
    $qr_class = Tribe__Tickets_Plus__Main::instance()->qr();
    remove_action( ‘tribe_tickets_ticket_email_ticket_bottom’, array( $qr_class, ‘inject_qr’ ) );
    }
    }
    add_action( ‘init’, ‘tribe_neuter_qr’, 10 );

    /**
    * BCC site admin email on all Event Tickets’ RSVP ticket emails so they get a copy of it too
    *
    * From
    *
    * 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’ );

    `

    Posts: 16 Topics: 10
    | Permalink

    Hello,

    Unfortunately that code did not work either. Nothing is being sent. I have checked my spam folder.

    Thanks,
    Ryan

    Posts: 4427 Topics: 2
    | Permalink

    Hi Ryan,

    Sorry to hear this still doesn’t work.

    Do you get other emails from the website? For example when you create a new user or when you change a password? If you also don’t receive those emails then that needs to be fixed first.

    Might be worth using an SMTP plugin for sending emails. These are usually much more reliable then the built-in function of WordPress.

    To eliminate the possibility of any conflicts with other plugins and customizations the best would be to deactivate all non-Modern Tribe plugins and to switch to a default theme like twentyseventeen and insert only the BCC email customization into the functions.php file of that theme.

    Could you give this a check?

    A.

    Posts: 16 Topics: 10
    | Permalink

    Hi András,

    I appreciate your help. I’m sorry this isn’t resolved.

    I tried deactivating all plugins and using the 2017 default theme and unfortunately it still did not work. I am getting notification emails for orders and tickets without a problem, but am not getting the bcc from this php code.

    Thanks,
    Ryan

    Posts: 4427 Topics: 2
    | Permalink

    Hi Ryan,

    I’m really sorry to hear that. Please give me some time so I can do some investigation. We’re currently experiencing a heavy load in the forums but I’ll try to get back to you in 2-3 days. Thanks for your patience.

    Cheers,
    Andras

You must be logged in and hold an active support license to create new topics in the help desk. Please visit our products store to purchase a license.

Subscribe to Updates