Notify Organizer via email when their community Event is published?

Home Forums Calendar Products Community Events Notify Organizer via email when their community Event is published?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1024462
    Ameet
    Participant

    Hello,
    Just wanted to see if you would be adding support to email the organizer when their event has been approved and is live in the calendar? We allow people to submit events and they go into a pending state, but after we (Admin) publish, they aren’t really notified. How would we go about doing this?

    • This topic was modified 10 years, 5 months ago by Ameet.
    • This topic was modified 10 years, 5 months ago by Geoff.
    #1024807
    Geoff
    Member

    Hi @Ameet, nice to see you again!

    That is indeed something that has popped up in our feature request forum. We don’t have any plans for that at the moment, but please do add your vote to the request–it needs more votes and having yours would help.

    Thanks,
    Geoff

    #1027657
    Ameet
    Participant

    Got it going,
    For anyone else looking to do this, just use wordpress’s Post Status Transition {old_status}_to_{new_status} hook.
    Here is what I did and it is working fine:

    
    function on_publish_pending_post( $post ) {
        $post_id = $post->ID;
        $author_id=$post->post_author;
        if ( ! tribe_is_event() ) return;
        // If this is just a revision, don't send the email.
        if ( wp_is_post_revision( $post_id ) ) return;
    	$subject = "Your event is live!";
    	$post_url = get_permalink( $post_id );
    	$post_title = get_the_title( $post_id );
    	$message .= "Your event has been approved and published publicly.";
    	$message .= $post_title . "<br>" . $post_url;
            
    	// Get the organizer's email address
    	$user_email = get_the_author_meta( 'user_email', $author_id );
    	// Send email to the organizer
    	wp_mail( $user_email, $subject, $message );
    }
    add_action(  'pending_to_publish',  'on_publish_pending_post', 10, 1 );
    
    • This reply was modified 10 years, 4 months ago by Ameet.
    #1027664
    Geoff
    Member

    Heck yeah! Nice work, @Ameet!

    Thanks so much for following up and for sharing what worked–I really appreciate it. 🙂

    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Notify Organizer via email when their community Event is published?’ is closed to new replies.