• Resolved tracyemma

    (@tracyemma)


    I need to implement both of the following functions. If added individually, each works, but together, they do not. How can this be rewritten so that they will function together? Thanks

    // Adds additional rsvp notifications
    function your_function_mail_bcc( $headers = array(), $event_id = null, $order_id = null ) {
        $headers[] = 'bcc: [email protected]';
     	return $headers;
     }
     add_filter( 'tribe_rsvp_email_headers', 'your_function_mail_bcc' );
    
    // Add a custom "from" name and email to the rsvps
     add_filter( 'tribe_rsvp_email_headers', function() {
      $name  = 'Website Name';
      $email = '[email protected]';
     
      return 'Content-type: text/html' . "\r\n" . "From: $name <$email>" . "\r\n";
     } );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @tracyemma,

    Thank you for reaching out. You’re using the same filter to hook twice and then returning two different types of data. On the first one, you return an array. On the second, you’re returning a string. You could possibly adapt things to use just one function.

    
    // Adds additional rsvp notifications.
    function your_function_mail_headers( $headers = array(), $event_id = null, $order_id = null ) {
        $name  = 'Website Name';
        $email = '[email protected]';
    
        $headers[] = 'Content-type: text/html';
        $headers[] = 'bcc: [email protected]';
        $headers[] = "From: $name <$email>";
    
        return $headers;
     }
     add_filter( 'tribe_rsvp_email_headers', 'your_function_mail_headers', 10, 3 );
    
    

    Best,
    Juan.

    Thread Starter tracyemma

    (@tracyemma)

    Hi @juanfra

    That worked. Thank you for the help and the explanation; I really appreciate it.

    Hi @tracyemma,

    Thanks for the follow-up.

    I’m glad to be of help 🙂 Grateful that you like the plugin and support.

    Have a fantastic day,
    Juan.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Need help with child theme functions code’ is closed to new replies.