diff --git a/includes/save.php b/includes/save.php index a1552178..396f9d31 100644 --- a/includes/save.php +++ b/includes/save.php @@ -23,7 +23,7 @@ //handle all the metadata, location add_action('save_post', function ($post_id, $post, $update) { - global $tsml_nonce, $wpdb, $tsml_notification_addresses, $tsml_days, $tsml_contact_fields; + global $tsml_nonce, $wpdb, $tsml_notification_addresses, $tsml_days, $tsml_contact_fields, $tsml_export_columns; //security if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { @@ -161,7 +161,7 @@ } //compare types - if (tsml_program_has_types() && (!$update || implode(', ', $old_meeting->types) != tsml_meeting_types($_POST['types']))) { + if (tsml_program_has_types() && (!$update || tsml_meeting_types($old_meeting->types) != tsml_meeting_types($_POST['types']))) { $changes[] = 'types'; if (empty($_POST['types'])) { delete_post_meta($post->ID, 'types'); @@ -298,7 +298,7 @@ // save timezone if (!$update || strcmp($old_meeting->timezone, $_POST['timezone']) !== 0) { - $changes[] = 'timezone' ; + $changes[] = 'timezone'; if (!tsml_timezone_is_valid($_POST['timezone'])) { delete_post_meta($location_id, 'timezone'); } else { @@ -444,7 +444,7 @@ //don't notify for lat / lon changes $changes = array_diff($changes, ['latitude', 'longitude']); - if (count($tsml_notification_addresses) && count($changes)) { + if (count($tsml_notification_addresses) && count($changes) && $_POST['post_status'] === 'publish') { $message = '
'; if ($update) { $message .= sprintf(__('This is to notify you that %s updated a meeting on the %s site.', '12-step-meeting-list'), $user->display_name, get_permalink($post->ID), get_bloginfo('name')); @@ -452,16 +452,12 @@ $message .= sprintf(__('This is to notify you that %s created a new meeting on the %s site.', '12-step-meeting-list'), $user->display_name, get_permalink($post->ID), get_bloginfo('name')); } $message .= '
' . $field_name . ' | '; if (!empty($old)) { |