• Resolved starent1

    (@starent1)


    I just realized during testing that this has no option for sending an email to an event organizer, letting know that new tickets have been purchased.

    Any chance you could help me figure out how to get that to happen? I’m not opposed to editing the code, if you don’t want to update the main plugin with this, but would be VERY helpful, and can be as simple as “New tickets have been purchased. Please login at domain.com to view the info.” Or, at the very least, simply sending a copy of the receipt email to event organizer would work.

    Thanks!

    http://wordpress.org/extend/plugins/camptix/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Konstantin Kovshenin

    (@kovshenin)

    You can do that with an action to transition_post_status and the wp_mail function to send an e-mail. You can learn more here: http://codex.wordpress.org/Post_Status_Transitions

    Thread Starter starent1

    (@starent1)

    Thanks for pointing me there; and while I love learning new things, my timeframe is tight. Unfortunately, I don’t know this type of stuff well, and need to get this site online asap.

    Any chance you would be willing to provide some code to get this done, referencing only the attendee post type?

    I would be willing to compensate you for your time, if necessary.

    Thank so much!

    Thread Starter starent1

    (@starent1)

    Ok, I was more ambitious than I figured… I plugged this into the functions.php:

    // function to be executed when custom post type tix_attendee is published
    function new_registration_notify() {
    		$message = "Message...";
    		$headers = 'From: Who From <from@emailaddress.com>' . "\r\n";
    		wp_mail('to@emailaddress.com', "Subject...", $message, $headers);
    }
    
    	add_action('publish_tix_attendee', 'new_registration_notify');

    This actually seems to work! However, I’m receiving two copies of the email for some reason. Any idea why?

    Plugin Author Konstantin Kovshenin

    (@kovshenin)

    Not sure, but that action is fired in wp_transition_post_status, and my guess is that it’s also fired for publish to publish transitions, so what you’d need is the other action called transition_post_status. Off the top of my head:

    function my_transition( $new, $old, $post ) {
        if ( $new == $old || $new != 'publish' || $post->post_type != 'tix_attendee' )
            return;
    
        // do your stuff
    }
    add_action( 'transition_post_status', 'my_transition', 10, 3 );
    Thread Starter starent1

    (@starent1)

    When I switch to your code, I get the following in browser after submitting the form online:

    Warning: Missing argument 2 for new_registration_notify() in /.../wp-content/themes/<theme>/functions.php on line 726

    Note in case it’s in question: I did replace “\\do your stuff” with the wp_mail code.

    Plugin Author Konstantin Kovshenin

    (@kovshenin)

    Can you post the exact code you’re trying to use?

    Thread Starter starent1

    (@starent1)

    I replaced “\\do your stuff” with the wp_mail code that worked using the originally-posted function (only that one sent it twice).

    Plugin Author Konstantin Kovshenin

    (@kovshenin)

    Just paste the code that you’re using 🙂

    Thread Starter starent1

    (@starent1)

    Ok, I must have fat-fingered something the first time. Works perfectly!

    Thank you very much for taking the time to answer this for me.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Need email sent to event organizer’ is closed to new replies.