No ability for Events+ to send a notification when an event is changed

The notifications system for Events+ is pretty good, but it was noted by the client that it doesn't have the ability to send notifications when an event date is changed. Seems that this should be a core functionality since events can get rescheduled. Might be nice for RSVP'ers to get a notification of that change.

Is this some thing that can be worked in?

The attached screenshot illustrates the limitation.

  • Dimitris

    Hello Saunt Valerian,

    hope you're doing good today! :slight_smile:

    In order to send email notification to all RSVPs when an event is modified, you should go to
    Events -> Settings -> Add-ons and activate the "Alert RSVPs on event modification".

    Then navigate to Events -> Settings -> Alert RSVP Settings and build your email template using the provided macros.

    Just tested that in a local installation of mine, and emails are being sent off with a simple change in the dates of a event. :wink:

    Hope that was some help, let us know if further assistance is required here!
    Warm regards,
    Dimitris

  • Saunt Valerian

    Dimitris I need to revisit this briefly. We set up the template, but noted that there are only 4 macros tags shown as possible here, they are: DISPLAY_NAME, EVENT_NAME, START_DATE, START_TIME, END_DATE, END_TIME

    There is no option to add the event URL.

    In contrast, one of the other module related to emails (RSVP Notification Email Settings), has a wider variety of macros tags available: EVENT_NAME, EVENT_START_DATE, EVENT_END_DATE, EVENT_DATE_INFO, EVENT_BODY, EVENT_BODY_HTML, EVENT_VENUE, EVENT_URL, EVENT_LINK, EVENT_HOST, USER_NAME, HAS_PAID

    The one we are mainly interested in the the EVENT_URL macros tag. Will that tag work with the Alert RSVP settings, and if not, is there a way to make it work so we can include a link in the alert emails as well.

  • Dimitris

    Hello there Saunt Valerian,

    hope you're doing good today! :slight_smile:

    As you can also see in events-and-bookings/lib/plugins/eab-event-alert-rsvp.php file, only these six macros are supported in this addon.

    In order to add additional macros, some custom work should be made. I've already escalated this to our Second Level Support team, just in case this isn't too complicated.
    I really can't promise anything though, we should wait for SLS feedback on this.
    Me or another colleague of mine will keep you posted here as soon as possible! :slight_smile:

    In case this is too urgent for you, you can always advise our jobs board page, Jobs & Pros, for this custom work. Please keep in mind that no WPMUDEV staff in included there.

    Warm regards,
    Dimitris

  • Ivan

    Hi Saunt Valerian !

    You can add a MU plugin ( for example, create {wordpress_folder}/wp-content/mu-plugins/wpmu_events_add_macros.php file via FTP ) with the following code

    <?php
    function wpmu_events_add_macros( $data ) {
    	global $additional_macros;
    	if ( !empty( $additional_macros['event_url'] ) ) {
    		$data['message'] = str_replace( 'EVENT_URL', $additional_macros['event_url'], $data['message'] );
    	}
    
    	return $data;
    }
    
    function pre_notify_rsvp_on_update_event( $post_id, $post ) {
    	if ( current_user_can('edit_posts') && !wp_is_post_revision( $post_id ) && 'incsub_event' == get_post_type( $post_id ) ) {
    		global $additional_macros;
    //		$event = ($post instanceof Eab_EventModel) ? $post : new Eab_EventModel($post);
    		$additional_macros['event_url'] = get_permalink( $post_id );
    	}
    }
    
    add_action( 'save_post', 'pre_notify_rsvp_on_update_event', 98, 2 );
    add_filter( 'wp_mail', 'wpmu_events_add_macros' );

    It will work only for the EVENT_URL macro tag. If you need other macros - use this code instead of the previous

    <?php
    function wpmu_events_add_macros( $data ) {
    	global $additional_macros;
    	if ( !empty( $additional_macros['event_url'] ) ) {
    		$data['message'] = str_replace(
    				array( 'EVENT_URL', 'EVENT_DATE_INFO', 'EVENT_BODY_HTML', 'EVENT_BODY', 'EVENT_VENUE', 'EVENT_LINK', 'EVENT_HOST' ),
    				array( $additional_macros['event_url'], $additional_macros['event_date_info'], $additional_macros['event_body_html'], $additional_macros['event_body'], $additional_macros['event_venue'], $additional_macros['event_link'], $additional_macros['event_host'] ),
    				$data['message'] );
    	}
    
    	return $data;
    }
    
    function pre_notify_rsvp_on_update_event( $post_id, $post ) {
    	if ( current_user_can('edit_posts') && !wp_is_post_revision( $post_id ) && 'incsub_event' == get_post_type( $post_id ) && class_exists( 'Eab_EventModel' ) ) {
    		global $additional_macros;
    		$event = ($post instanceof Eab_EventModel) ? $post : new Eab_EventModel($post);
    		$additional_macros['event_url'] = get_permalink( $post_id );
    		$additional_macros['event_date_info'] = function_exists( 'eab_call_template' ) ? wp_strip_all_tags(eab_call_template('get_event_dates', $event->_event)) : '';
    		$additional_macros['event_body'] = wp_strip_all_tags($event->get_content());
    		$additional_macros['event_body_html'] = $event->get_content();
    		$additional_macros['event_venue'] = $event->get_venue_location(Eab_EventModel::VENUE_AS_ADDRESS);
    		$additional_macros['event_link'] = function_exists( 'eab_call_template' ) ? eab_call_template('get_event_link', $event->_event) : '';
    		$additional_macros['event_host'] = function_exists( 'eab_call_template' ) ? wp_strip_all_tags(eab_call_template('get_event_author_link', $event->_event)) : '';
    	}
    }
    
    add_action( 'save_post', 'pre_notify_rsvp_on_update_event', 98, 2 );
    add_filter( 'wp_mail', 'wpmu_events_add_macros' );

    Best regards,
    Ivan.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.