<?php
$eventID                        = 0;
$buttonText                     = 'Create Event';
$opendate                       = '';
$opendate_time_zone             = '';
$opendate_time                  = '';
$closedate                      = '';
$closedate_time                 = '';
$repeatStartDate                = '';
$closedate_time_zone            = '';
$closedate_time_zone            = '';
$parentEventID                  = 0;
$eventName                      = '';
$greetingText                   = '';
$welcomeText                    = '';
$hide_welcome_text              = 'N';
$hide_main_rsvp_question        = 'N';
$rsvpQuestionText               = '';
$rsvpYesLabel                   = '';
$rsvpNoLabel                    = '';
$rsvpWaitlistLabel              = '';
$text_under_rsvp                = '';
$rsvp_maybe_label               = '';
$additionalNoteLabel            = '';
$plus_one_enabled               = 'N';
$plus_one_label                 = '';
$thankYouText                   = '';
$thank_you_redirect             = '';
$not_coming_redirect            = '';
$hideAdditionalGuests           = 'N';
$notifyUser                     = 'N';
$notifyEmail                    = '';
$requirePasscode                = 'N';
$unique_passcode                = 'N';
$first_name_js_message          = '';
$last_name_js_message           = '';
$note_js_message                = '';
$email_js_message               = '';
$gdpr_js_message                = '';
$unique_passcode_js_message     = '';
$unique_email_js_message        = '';
$hideNote                       = 'N';
$rsvpOpenReg                    = 'N';
$hide_search_form               = 'N';
$display_search_button_text     = '';
$rsvp_open_prompt_to_add        = 'N';
$rsvp_open_prompt_to_add_text   = '';
$dontUseHash                    = 'N';
$addAdditionalText              = '';
$guestEmailConfirm              = 'N';
$numAdditionalGuests            = '';
$hideEmailField                 = 'N';
$unique_email_validation        = 'N';
$disableCustomEmailFrom         = 'N';
$onlyPasscode                   = 'N';
$rsvpEmailText                  = '';
$rsvpNoEditing                  = 'N';
$rsvp_no_edit_prompt            = 'N';
$rsvp_only_once                 = 'N';
$rsvp_only_once_text            = '';
$rsvpDisableUserSearch          = 'N';
$notComingVerbiage              = '';
$thankyou_modify_text           = '';
$thankyou_password_text         = '';
$thankyou_associated_text       = '';
$showSuffix                     = 'N';
$showSalutation                 = 'N';
$salutations                    = RSVP_PRO_DEFAULT_SALUTATION;
$password_length                = 6;
$showNoResponse                 = 'N';
$attendeeAccess                 = array();
$hasMultipleEvents              = false;
$requireEmail                   = 'N';
$requireRsvpValues              = 'N';
$hide_rsvp                      = 'N';
$default_rsvp_value             = '';
$noPasscodeOnOpen               = 'N';
$passcode_editable_label        = '';
$frontendWizard                 = 'N';
$newAttendeeButtonText          = '';
$rsvpFrontendButtonText         = '';
$nextButtonText                 = '';
$rsvpLimit                      = '';
$rsvpLimitText                  = '';
$rsvpEnableWaitlist             = 'N';
$rsvp_enable_maybe              = 'N';
$rsvpWaitlistText               = '';
$openDateText                   = '';
$closeDateText                  = '';
$attendeelistFilter             = array();
$attendeelistSortOrder          = '';
$attendeeListHideStatus         = 'N';
$attendeeListCustomQs           = array();
$attendee_list_show_email       = 'N';
$attendee_list_show_summary     = 'N';
$attendee_list_show_associated  = 'N';
$attendee_list_export_button    = 'N';
$attendee_list_show_note        = 'N';
$attendee_list_page_size        = '';
$attendeeAutoLogin              = 'N';
$modifyRegistrationText         = '';
$addAttendeeButtonText          = '';
$adminRoles                     = array();
$emailFrom                      = '';
$emailCCAssociated              = 'N';
$email_associated_individually  = 'N';
$emailBCCAddresses              = '';
$emailSubject                   = '';
$admin_email_subject            = '';
$admin_email_body               = '';
$email_body                     = '';
$no_email_body                  = '';
$maybe_email_body               = '';
$waitlist_email_body            = '';
$email_include_ics              = 'N';
$firstNameLabel                 = '';
$lastNameLabel                  = '';
$completeButtonText             = '';
$passcodeLabel                  = '';
$editPromptText                 = '';
$suffixLabel                    = '';
$salutationLabel                = '';
$emailLabel                     = '';
$associatedMessage              = '';
$associatedGreeting             = '';
$multiEventTitle                = '';
$multiOptionText                = '';
$removeAttendeeButton           = '';
$yesText                        = '';
$noText                         = '';
$maybe_text                     = '';
$plus_one_text                  = '';
$hi_text                        = '';
$noResponseText                 = '';
$multipleMatchesText            = '';
$multiple_attendee_text         = '';
$fuzzyMatchText                 = '';
$unableFindText                 = '';
$welcomeBackText                = '';
$partialUserSearch              = 'N';
$lastNameNotRequired            = 'N';
$autoWaitlistToYes              = 'N';
$waitlistYesUnavailable         = 'N';
$waitlistPermSwitch             = 'N';
$waitlistStatusEmail            = '';
$eventEndDate                   = '';
$eventStartDate                 = '';
$eventStartDateTimezone         = '';
$eventEndDateTimezone           = '';
$eventLocation                  = '';
$eventDescription               = '';
$showCalendarLink               = 'N';
$calendarLinkText               = '';
$google_calendar_link_text      = '';
$additionalAttendeeText         = '';
$repeatStatDate                 = '';
$repeatEndDate                  = '';
$repeatFrequencyType            = '';
$repeatFrequency                = 1;
$repeatLength                   = 1;
$repeatLengthType               = '';
$repeatCurrentEndDate           = '';
$repeatDoNotSaveEvent           = 'N';
$useEmailForLookup              = 'N';
$showEventInfo                  = 'N';
$attendeeListAllowRsvp          = 'N';
$sendAttendeeList               = 'N';
$sendAttendeeListEmail          = '';
$sendAttendeeListFormat         = '';
$sendAttendeeListNote           = '';
$attendee_list_sent_on          = '';
$eventAccess                    = '';
$first_last_editable            = 'N';
$roles_auto_enroll              = array();
$allow_checkin                  = 'N';
$attendeelist_allow_checkin     = 'N';
$attendeelist_show_search       = 'N';
$attendeelist_search_text       = '';
$attendeelist_checkin_text      = '';
$attendeelist_checked_in_text   = '';
$attendee_list_columns          = array();
$show_gdpr_question             = 'N';
$gdpr_question_text             = '';
$enable_recaptcha               = 'N';
$recaptcha_site_key             = '';
$recaptcha_secret_key           = '';
$enable_ajax                    = 'N';
$show_new_attendee_form_first   = 'N';
$find_attendee_link_text        = '';
$waitlist_friendly_text         = '';
$rsvp_form_url                  = '';
$form_show_profile_pic          = 'N';
$attendee_list_show_profile_pic = 'N';
$always_show_additional         = 'N';
$event_options                  = new Rsvp_Pro_Event_Options();
$enable_turnstile               = 'N';
$turnstile_site_key             = '';
$turnstile_secret_key           = '';

$event_name = ( isset( $_POST ) && ( !empty( $_POST['eventName'] ) ) ) ? $_POST['eventName'] : __( 'Default event title', 'rsvp-pro-plugin' );

if ( isset( $_POST ) && ( isset( $_POST['eventName'] ) ) ){
	$eventName                     = $event_name;
	$eventLocation                 = $_POST['eventLocation'];
	$eventDescription              = $_POST['eventDescription'];
	$opendate                      = '';
	$closedate                     = '';
	$opendate_time                 = '';
	$opendate_time_zone            = '';
	$closedate_time                = '';
	$closedate_time_zone           = '';
	$parentEventID                 = 0;
	$eventAccess                   = ( isset( $_POST['event_access'] ) ? $_POST['event_access'] : '' );
	$greetingText                  = $_POST['greeting_text'];
	$welcomeText                   = $_POST['welcome_text'];
	$rsvpQuestionText              = $_POST['rsvp_question_text'];
	$rsvpYesLabel                  = $_POST['rsvp_yes_label'];
	$rsvpNoLabel                   = $_POST['rsvp_no_label'];
	$text_under_rsvp               = $_POST[ RSVP_PRO_OPTION_UNDER_RSVP_TEXT ];
	$rsvpWaitlistLabel             = $_POST[ RSVP_PRO_OPTION_WAITLIST_VERBIAGE ];
	$rsvp_maybe_label              = $_POST[ RSVP_PRO_OPTION_MAYBE_VERBIAGE ];
	$additionalNoteLabel           = $_POST['additional_note_label'];
	$plus_one_label                = $_POST[ RSVP_PRO_OPTION_PLUS_ONE_LABEL ];
	$plus_one_enabled              = ( isset( $_POST[ RSVP_PRO_OPTION_PLUS_ONE_ENABLED ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_PLUS_ONE_ENABLED ] ) ) ? 'Y' : 'N';
	$thankYouText                  = $_POST['thank_you_text'];
	$thank_you_redirect            = ( isset( $_POST[ RSVP_PRO_OPTION_THANKYOU_REDIRECT ] ) ) ? $_POST[ RSVP_PRO_OPTION_THANKYOU_REDIRECT ] : '';
	$not_coming_redirect           = ( isset( $_POST[ RSVP_PRO_OPTION_NOT_COMING_REDIRECT ] ) ) ? $_POST[ RSVP_PRO_OPTION_NOT_COMING_REDIRECT ] : '';
	$hideAdditionalGuests          = ( isset( $_POST['hide_additional_guests'] ) && ( $_POST['hide_additional_guests'] === 'Y' ) ) ? 'Y' : 'N';
	$notifyUser                    = ( isset( $_POST['notify_user'] ) && ( $_POST['notify_user'] == 'Y' ) ) ? 'Y' : 'N';
	$notifyEmail                   = $_POST['notify_email'];
	$requirePasscode               = ( isset( $_POST['require_passcode'] ) && ( $_POST['require_passcode'] == 'Y' ) ) ? 'Y' : 'N';
	$unique_passcode               = ( isset( $_POST[ RSVP_PRO_OPTION_PASSCODE_UNIQUE ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_PASSCODE_UNIQUE ] ) ) ? 'Y' : 'N';
	$passcode_editable             = ( isset( $_POST[ RSVP_PRO_OPTION_PASSCODE_EDITABLE ] ) && ( $_POST[ RSVP_PRO_OPTION_PASSCODE_EDITABLE ] === 'Y' ) ) ? 'Y' : 'N';
	$passcode_editable_label       = $_POST[ RSVP_PRO_OPTION_PASSCODE_EDITABLE_LABEL ];
	$first_name_js_message         = $_POST[ RSVP_PRO_OPTION_FIRST_NAME_JS_MESSAGE ];
	$last_name_js_message          = $_POST[ RSVP_PRO_OPTION_LAST_NAME_JS_MESSAGE ];
	$note_js_message               = $_POST[ RSVP_PRO_OPTION_NOTE_JS_MESSAGE ];
	$email_js_message              = $_POST[ RSVP_PRO_OPTION_EMAIL_JS_MESSAGE ];
	$gdpr_js_message               = $_POST[ RSVP_PRO_OPTION_GDPR_JS_MESSAGE ];
	$unique_passcode_js_message    = $_POST[ RSVP_PRO_OPTION_UNIQUE_PASSCODE_JS_MESSAGE ];
	$unique_email_js_message       = $_POST[ RSVP_PRO_OPTION_UNIQUE_EMAIL_JS_MESSAGE ];
	$hideNote                      = ( isset( $_POST['hide_note'] ) && ( $_POST['hide_note'] == 'Y' ) ) ? 'Y' : 'N';
	$rsvpOpenReg                   = ( isset( $_POST['rsvp_open_registration'] ) && ( $_POST['rsvp_open_registration'] == 'Y' ) ) ? 'Y' : 'N';
	$hide_search_form              = ( isset( $_POST[ RSVP_PRO_OPTION_HIDE_SEARCH_FORM ] ) && ( $_POST[ RSVP_PRO_OPTION_HIDE_SEARCH_FORM ] == 'Y' ) ) ? 'Y' : 'N';
	$display_search_button_text    = $_POST[ RSVP_PRO_OPTION_DISPLAY_SEARCH_FORM_TEXT ];
	$rsvp_open_prompt_to_add       = ( isset( $_POST[ RSVP_PRO_OPTION_PROMPT_TO_ADD_IF_NOT_FOUND ] ) && ( $_POST[ RSVP_PRO_OPTION_PROMPT_TO_ADD_IF_NOT_FOUND ] === 'Y' ) ) ? 'Y' : 'N';
	$rsvp_open_prompt_to_add_text  = stripslashes( $_POST[ RSVP_PRO_OPTION_PROMPT_TO_ADD_IF_NOT_FOUND_TEXT ] );
	$dontUseHash                   = ( isset( $_POST['rsvp_dont_use_hash'] ) && ( $_POST['rsvp_dont_use_hash'] == 'Y' ) ) ? 'Y' : 'N';
	$addAdditionalText             = $_POST['rsvp_add_additional_verbiage'];
	$guestEmailConfirm             = ( isset( $_POST['rsvp_guest_email_confirmation'] ) && ( $_POST['rsvp_guest_email_confirmation'] == 'Y' ) ) ? 'Y' : 'N';
	$numAdditionalGuests           = $_POST['rsvp_num_additional_guests'];
	$hideEmailField                = ( isset( $_POST['rsvp_hide_email_field'] ) && ( $_POST['rsvp_hide_email_field'] == 'Y' ) ) ? 'Y' : 'N';
	$unique_email_validation       = ( isset( $_POST[ RSVP_PRO_OPTION_EMAIL_UNIQUE_VALIDATION ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_EMAIL_UNIQUE_VALIDATION ] ) ) ? 'Y' : 'N';
	$onlyPasscode                  = ( isset( $_POST['rsvp_only_passcode'] ) && ( $_POST['rsvp_only_passcode'] == 'Y' ) ) ? 'Y' : 'N';
	$rsvpEmailText                 = $_POST[ RSVP_PRO_OPTION_EMAIL_TEXT ];
	$rsvpNoEditing                 = ( isset( $_POST[ RSVP_PRO_OPTION_CANT_EDIT ] ) && ( $_POST[ RSVP_PRO_OPTION_CANT_EDIT ] == 'Y' ) ) ? 'Y' : 'N';
	$rsvp_no_edit_prompt           = ( isset( $_POST[ RSVP_PRO_OPTION_NO_EDIT_PROMPT ] ) && ( $_POST[ RSVP_PRO_OPTION_NO_EDIT_PROMPT ] == 'Y' ) ) ? 'Y' : 'N';
	$rsvp_only_once                = ( isset( $_POST[ RSVP_PRO_OPTION_ONLY_RSVP_ONCE ] ) && ( $_POST[ RSVP_PRO_OPTION_ONLY_RSVP_ONCE ] == 'Y' ) ) ? 'Y' : 'N';
	$rsvp_only_once_text           = ( isset( $_POST[ RSVP_PRO_OPTION_RSVP_ONLY_ONCE_TEXT ] ) ) ? $_POST[ RSVP_PRO_OPTION_RSVP_ONLY_ONCE_TEXT ] : '';
	$rsvpDisableUserSearch         = ( isset( $_POST[ RSVP_PRO_OPTION_DISABLE_USER_SEARCH ] ) && ( $_POST[ RSVP_PRO_OPTION_DISABLE_USER_SEARCH ] == 'Y' ) ) ? 'Y' : 'N';
	$notComingVerbiage             = ( isset( $_POST[ RSVP_PRO_OPTION_NOT_COMING ] ) ) ? $_POST[ RSVP_PRO_OPTION_NOT_COMING ] : '';
	$thankyou_modify_text          = ( isset( $_POST[ RSVP_PRO_OPTION_THANKYOU_MODIFY_TEXT ] ) ) ? $_POST[ RSVP_PRO_OPTION_THANKYOU_MODIFY_TEXT ] : '';
	$thankyou_password_text        = ( isset( $_POST[ RSVP_PRO_OPTION_THANKYOU_PASSWORD_TEXT ] ) ) ? $_POST[ RSVP_PRO_OPTION_THANKYOU_PASSWORD_TEXT ] : '';
	$thankyou_associated_text      = ( isset( $_POST[ RSVP_PRO_OPTION_THANKYOU_ASSOCIATED_TEXT ] ) ) ? $_POST[ RSVP_PRO_OPTION_THANKYOU_ASSOCIATED_TEXT ] : '';
	$showSuffix                    = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_SUFFIX ] ) && ( $_POST[ RSVP_PRO_OPTION_SHOW_SUFFIX ] == 'Y' ) ) ? 'Y' : 'N';
	$showSalutation                = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_SALUTATION ] ) && ( $_POST[ RSVP_PRO_OPTION_SHOW_SALUTATION ] == 'Y' ) ) ? 'Y' : 'N';
	$showNoResponse                = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_NORESPONSE_FOR_ASSOCIATED ] ) && ( $_POST[ RSVP_PRO_OPTION_SHOW_NORESPONSE_FOR_ASSOCIATED ] == 'Y' ) ) ? 'Y' : 'N';
	$noPasscodeOnOpen              = ( isset( $_POST[ RSVP_PRO_OPTION_RSVP_OPEN_NO_PASSCODE ] ) && ( $_POST[ RSVP_PRO_OPTION_RSVP_OPEN_NO_PASSCODE ] == 'Y' ) ) ? 'Y' : 'N';
	$requireRsvpValues             = ( isset( $_POST[ RSVP_PRO_OPTION_RSVP_REQUIRED ] ) && ( $_POST[ RSVP_PRO_OPTION_RSVP_REQUIRED ] == 'Y' ) ) ? 'Y' : 'N';
	$hide_rsvp                     = ( isset( $_POST[ RSVP_PRO_OPTION_RSVP_HIDE ] ) && ( $_POST[ RSVP_PRO_OPTION_RSVP_HIDE ] === 'Y' ) ? 'Y' : 'N' );
	$hide_welcome_text             = ( isset( $_POST[ RSVP_PRO_OPTION_HIDE_WELCOME ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_HIDE_WELCOME ] ) ) ? 'Y' : 'N';
	$hide_main_rsvp_question       = ( isset( $_POST[ RSVP_PRO_OPTION_HIDE_RSVP_QUESTION ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_HIDE_RSVP_QUESTION ] ) ) ? 'Y' : 'N';
	$default_rsvp_value            = ( isset( $_POST[ RSVP_PRO_OPTION_DEFAULT_RSVP_VALUE ] ) ) ? $_POST[ RSVP_PRO_OPTION_DEFAULT_RSVP_VALUE ] : '';
	$requireEmail                  = ( isset( $_POST[ RSVP_PRO_OPTION_EMAIL_REQUIRED ] ) && ( $_POST[ RSVP_PRO_OPTION_EMAIL_REQUIRED ] == 'Y' ) ) ? 'Y' : 'N';
	$salutations                   = str_replace( "\r\n", '||', $_POST[ RSVP_PRO_OPTION_SALUTATIONS ] );
	$frontendWizard                = ( isset( $_POST[ RSVP_PRO_OPTION_FRONTEND_WIZARD ] ) && ( $_POST[ RSVP_PRO_OPTION_FRONTEND_WIZARD ] == 'Y' ) ) ? 'Y' : 'N';
	$newAttendeeButtonText         = $_POST[ RSVP_PRO_OPTION_NEW_ATTENDEE_BUTTON_TEXT ];
	$rsvpFrontendButtonText        = $_POST[ RSVP_PRO_OPTION_RSVP_BUTTON_TEXT ];
	$nextButtonText                = $_POST[ RSVP_PRO_OPTION_NEXT_BUTTON_TEXT ];
	$rsvpLimitText                 = $_POST[ RSVP_PRO_OPTION_MAX_COUNT_REACHED_TEXT ];
	$rsvpEnableWaitlist            = ( isset( $_POST[ RSVP_PRO_OPTION_ENABLE_WAITLIST ] ) && ( $_POST[ RSVP_PRO_OPTION_ENABLE_WAITLIST ] == 'Y' ) ) ? 'Y' : 'N';
	$rsvp_enable_maybe             = ( isset( $_POST[ RSVP_PRO_OPTION_ENABLE_MAYBE ] ) && ( $_POST[ RSVP_PRO_OPTION_ENABLE_MAYBE ] === 'Y' ) ) ? 'Y' : 'N';
	$rsvpWaitlistText              = $_POST[ RSVP_PRO_OPTION_WAITLIST_TEXT ];
	$openDateText                  = $_POST[ RSVP_PRO_OPTION_OPEN_DATE_TEXT ];
	$closeDateText                 = $_POST[ RSVP_PRO_OPTION_CLOSE_DATE_TEXT ];
	$attendeeAutoLogin             = ( isset( $_POST[ RSVP_PRO_OPTION_AUTO_LOGIN_ATTENDEE ] ) && ( $_POST[ RSVP_PRO_OPTION_AUTO_LOGIN_ATTENDEE ] == 'Y' ) ) ? 'Y' : 'N';
	$modifyRegistrationText        = $_POST[ RSVP_PRO_OPTION_MODIFY_REGISTRATION_TEXT ];
	$addAttendeeButtonText         = $_POST[ RSVP_PRO_OPTION_ADD_ATTENDEE_BUTTON_TEXT ];
	$emailFrom                     = $_POST[ RSVP_PRO_OPTION_EMAIL_FROM ];
	$emailCCAssociated             = ( isset( $_POST[ RSVP_PRO_OPTION_EMAIL_CC_ASSOCIATED ] ) && ( $_POST[ RSVP_PRO_OPTION_EMAIL_CC_ASSOCIATED ] == 'Y' ) ) ? 'Y' : 'N';
	$email_associated_individually = ( isset( $_POST[ RSVP_PRO_OPTION_EMAIL_ASSOCIATED_INDIVIDUALLY ] ) && ( $_POST[ RSVP_PRO_OPTION_EMAIL_ASSOCIATED_INDIVIDUALLY ] == 'Y' ) ) ? 'Y' : 'N';
	$emailBCCAddresses             = $_POST[ RSVP_PRO_OPTION_EMAIL_BCC_ADDRESS ];
	$emailSubject                  = $_POST[ RSVP_PRO_OPTION_EMAIL_SUBJECT ];
	$admin_email_subject           = $_POST[ RSVP_PRO_OPTION_ADMIN_EMAIL_SUBJECT ];
	$admin_email_body              = $_POST[ RSVP_PRO_OPTION_ADMIN_EMAIL_BODY ];
	$email_body                    = $_POST[ RSVP_PRO_OPTION_EMAIL_BODY ];
	$no_email_body                 = ( isset( $_POST[ RSVP_PRO_OPTION_NO_EMAIL_BODY ] ) ) ? $_POST[ RSVP_PRO_OPTION_NO_EMAIL_BODY ] : '';
	$maybe_email_body              = $_POST[ RSVP_PRO_OPTION_MAYBE_EMAIL_BODY ];
	$waitlist_email_body           = ( isset( $_POST[ RSVP_PRO_OPTION_WAITLIST_EMAIL_BODY ] ) ) ? $_POST[ RSVP_PRO_OPTION_WAITLIST_EMAIL_BODY ] : '';
	$email_include_ics             = ( isset( $_POST[ RSVP_PRO_OPTION_EMAIL_INCLUDE_ICS ] ) && ( $_POST[ RSVP_PRO_OPTION_EMAIL_INCLUDE_ICS ] === 'Y' ) ) ? 'Y' : 'N';
	$firstNameLabel                = $_POST[ RSVP_PRO_OPTION_FIRST_NAME_LABEL ];
	$lastNameLabel                 = $_POST[ RSVP_PRO_OPTION_LAST_NAME_LABEL ];
	$completeButtonText            = $_POST[ RSVP_PRO_OPTION_COMPLETE_BUTTON_TEXT ];
	$passcodeLabel                 = $_POST[ RSVP_PRO_OPTION_PASSCODE_LABEL ];
	$editPromptText                = $_POST[ RSVP_PRO_OPTION_EDIT_PROMPT_TEXT ];
	$suffixLabel                   = $_POST[ RSVP_PRO_OPTION_SUFFIX_LABEL ];
	$salutationLabel               = $_POST[ RSVP_PRO_OPTION_SALUTATION_LABEL ];
	$emailLabel                    = $_POST[ RSVP_PRO_OPTION_EMAIL_LABEL ];
	$associatedMessage             = $_POST[ RSVP_PRO_OPTION_ASSOCIATED_MESSAGE ];
	$associatedGreeting            = $_POST[ RSVP_PRO_OPTION_ASSOCIATED_ATTENDEE_GREETING ];
	$multiEventTitle               = $_POST[ RSVP_PRO_OPTION_MULTI_EVENT_TITLE ];
	$multiOptionText               = $_POST[ RSVP_PRO_OPTION_MULTI_OPTION_TEXT ];
	$removeAttendeeButton          = $_POST[ RSVP_PRO_OPTION_REMOVE_ATTENDEE_BUTTON_TEXT ];
	$yesText                       = $_POST[ RSVP_PRO_OPTION_YES_TEXT ];
	$noText                        = $_POST[ RSVP_PRO_OPTION_NO_TEXT ];
	$maybe_text                    = $_POST[ RSVP_PRO_OPTION_MAYBE_TEXT ];
	$plus_one_text                 = $_POST[ RSVP_PRO_OPTION_YES_PLUS_ONE_TEXT ];
	$hi_text                       = $_POST[ RSVP_PRO_OPTION_HI_TEXT ];
	$noResponseText                = $_POST[ RSVP_PRO_OPTION_NO_RESPONSE_TEXT ];
	$multipleMatchesText           = $_POST[ RSVP_PRO_OPTION_MULTIPLE_MATCHES_TEXT ];
	$multiple_attendee_text        = ( isset( $_POST[ RSVP_PRO_OPTION_MULTIPLE_ATTENDEE_TEXT ] ) ) ? $_POST[ RSVP_PRO_OPTION_MULTIPLE_ATTENDEE_TEXT ] : '';
	$fuzzyMatchText                = $_POST[ RSVP_PRO_OPTION_FUZZY_MATCH_TEXT ];
	$attendeeListHideStatus        = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_HIDE_STATUS ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_HIDE_STATUS ] == 'Y' ) ) ? 'Y' : 'N';
	$attendee_list_export_button   = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_EXPORT_BUTTON ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_EXPORT_BUTTON ] ) ) ? 'Y' : 'N';
	$attendee_list_page_size       = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_PAGE_SIZE ];
	$welcomeBackText               = $_POST[ RSVP_PRO_OPTION_WELCOME_BACK_TEXT ];
	$unableFindText                = $_POST[ RSVP_PRO_OPTION_UNABLE_TO_FIND_TEXT ];
	$partialUserSearch             = ( isset( $_POST[ RSVP_PRO_OPTION_PARTIAL_MATCH_USER_SEARCH ] ) && ( $_POST[ RSVP_PRO_OPTION_PARTIAL_MATCH_USER_SEARCH ] == 'Y' ) ) ? 'Y' : 'N';
	$lastNameNotRequired           = ( isset( $_POST[ RSVP_PRO_OPTION_LAST_NAME_NOT_REQUIRED ] ) && ( $_POST[ RSVP_PRO_OPTION_LAST_NAME_NOT_REQUIRED ] == 'Y' ) ) ? 'Y' : 'N';
	$autoWaitlistToYes             = ( isset( $_POST[ RSVP_PRO_OPTION_WAITLIST_AUTO_CHANGE ] ) && ( $_POST[ RSVP_PRO_OPTION_WAITLIST_AUTO_CHANGE ] == 'Y' ) ) ? 'Y' : 'N';
	$waitlistYesUnavailable        = ( isset( $_POST[ RSVP_PRO_OPTION_WAITLIST_YES_UNAVAILABLE ] ) && ( $_POST[ RSVP_PRO_OPTION_WAITLIST_YES_UNAVAILABLE ] == 'Y' ) ) ? 'Y' : 'N';
	$waitlistPermSwitch            = ( isset( $_POST[ RSVP_PRO_OPTION_WAITLIST_PERM_SWITCH ] ) && ( $_POST[ RSVP_PRO_OPTION_WAITLIST_PERM_SWITCH ] == 'Y' ) ) ? 'Y' : 'N';
	$waitlistStatusEmail           = $_POST[ RSVP_PRO_OPTION_WAITLIST_STATUS_CHANGE_EMAIL ];
	$showCalendarLink              = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_CALENDAR_LINK ] ) && ( $_POST[ RSVP_PRO_OPTION_SHOW_CALENDAR_LINK ] == 'Y' ) ) ? 'Y' : 'N';
	$calendarLinkText              = $_POST[ RSVP_PRO_OPTION_CALENDAR_LINK_TEXT ];
	$google_calendar_link_text     = $_POST[ RSVP_PRO_OPTION_GOOGLE_CALENDAR_LINK_TEXT ];
	$additionalAttendeeText        = $_POST[ RSVP_PRO_OPTION_ADDITIONAL_GREETING_TEXT ];
	$repeatDoNotSaveEvent          = ( isset( $_POST[ RSVP_PRO_OPTION_REPEAT_DONT_SAVE_EVENTS ] ) && ( $_POST[ RSVP_PRO_OPTION_REPEAT_DONT_SAVE_EVENTS ] == 'Y' ) ) ? 'Y' : 'N';
	$useEmailForLookup             = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LOOKUP_VIA_EMAIL ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LOOKUP_VIA_EMAIL ] == 'Y' ) ) ? 'Y' : 'N';
	$showEventInfo                 = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_EVENT_INFO_ON_FRONTEND ] ) && ( $_POST[ RSVP_PRO_OPTION_SHOW_EVENT_INFO_ON_FRONTEND ] == 'Y' ) ) ? 'Y' : 'N';
	$attendeeListAllowRsvp         = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_RSVP_CHANGE ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_RSVP_CHANGE ] == 'Y' ) ) ? 'Y' : 'N';
	$sendAttendeeList              = ( isset( $_POST[ RSVP_PRO_OPTION_SEND_ATTENDEE_LIST ] ) && ( $_POST[ RSVP_PRO_OPTION_SEND_ATTENDEE_LIST ] == 'Y' ) ) ? 'Y' : 'N';
	$sendAttendeeListEmail         = $_POST[ RSVP_PRO_OPTION_SEND_ATTENDEE_LIST_EMAIL ];
	$sendAttendeeListFormat        = $_POST[ RSVP_PRO_OPTION_SEND_ATTENDEE_LIST_FORMAT ];
	$sendAttendeeListNote          = $_POST[ RSVP_PRO_OPTION_SEND_ATTENDEE_LIST_NOTE ];
	$first_last_editable           = isset( $_POST[ RSVP_PRO_OPTION_FIRST_LAST_EDITABLE ] ) ? $_POST[ RSVP_PRO_OPTION_FIRST_LAST_EDITABLE ] : 'N';
	$allow_checkin                 = ( isset( $_POST[ RSVP_PRO_OPTION_ALLOW_CHECKINS ] ) && ( $_POST[ RSVP_PRO_OPTION_ALLOW_CHECKINS ] == 'Y' ) ) ? 'Y' : 'N';
	$attendeelist_allow_checkin    = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_CHECKIN ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_ALLOW_CHECKIN ] == 'Y' ) ) ? 'Y' : 'N';
	$attendeelist_show_search      = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SEARCH ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SEARCH ] == 'Y' ) ) ? 'Y' : 'N';
	$attendeelist_search_text      = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER_TEXT ];
	$attendeelist_checkin_text     = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKIN_TEXT ];
	$attendeelist_checked_in_text  = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CHECKED_IN_TEXT ];
	$attendee_list_show_email      = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_EMAIL ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_EMAIL ] === 'Y' ) ) ? 'Y' : 'N';
	$attendee_list_show_note       = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_NOTE ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_NOTE ] ) ) ? 'Y' : 'N';
	$attendee_list_show_summary    = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SUMMARY ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_SUMMARY ] === 'Y' ) ) ? 'Y' : 'N';
	$attendee_list_show_associated = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_ASSOCIATED ] ) && ( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_ASSOCIATED ] === 'Y' ) ) ? 'Y' : 'N';
	$show_gdpr_question            = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_GDPR_QUESTION ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_SHOW_GDPR_QUESTION ] ) ) ? 'Y' : 'N';
	$gdpr_question_text            = $_POST[ RSVP_PRO_OPTION_GDPR_QUESTION_TEXT ];
	$enable_recaptcha              = ( isset( $_POST[ RSVP_PRO_OPTION_ENABLE_RECAPTCHA ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ENABLE_RECAPTCHA ] ) ) ? 'Y' : 'N';
	$recaptcha_site_key            = $_POST[ RSVP_PRO_OPTION_RECAPTCHA_SITE_KEY ];
	$recaptcha_secret_key          = $_POST[ RSVP_PRO_OPTION_RECAPTCHA_SECRET_KEY ];
	$enable_ajax                   = ( isset( $_POST[ RSVP_PRO_OPTION_ENABLE_AJAX ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ENABLE_AJAX ] ) ) ? 'Y' : 'N' ;
	$find_attendee_link_text       = $_POST[ RSVP_PRO_OPTION_FIND_ATTENDEES_LINK_TEXT ];
	$show_new_attendee_form_first  = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_NEW_ATTENDEE_FORM_FIRST ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_SHOW_NEW_ATTENDEE_FORM_FIRST ] ) ) ? 'Y' : 'N';
	$waitlist_friendly_text        = $_POST[ RSVP_PRO_OPTION_WAITLIST_FRIENDLY_TEXT ];
	$rsvp_form_url                 = $_POST[ RSVP_PRO_OPTION_FORM_URL ];
	$attendee_list_show_profile_pic = ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_PROFILE ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_PROFILE ] ) ) ? 'Y' : 'N';
	$form_show_profile_pic          = ( isset( $_POST[ RSVP_PRO_OPTION_SHOW_PROFILE_ON_FORM ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_SHOW_PROFILE_ON_FORM ] ) ) ? 'Y' : 'N';
	$always_show_additional         = ( isset( $_POST[ RSVP_PRO_OPTION_ALWAYS_SHOW_ADDITIONAL] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ALWAYS_SHOW_ADDITIONAL ] ) ) ? 'Y' : 'N';
	$enable_turnstile              = ( isset( $_POST[ RSVP_PRO_OPTION_ENABLE_TURNSTILE ] ) && ( 'Y' === $_POST[ RSVP_PRO_OPTION_ENABLE_TURNSTILE ] ) ) ? 'Y' : 'N';
	$turnstile_site_key            = $_POST[ RSVP_PRO_OPTION_TURNSTILE_SITE_KEY ];
	$turnstile_secret_key          = $_POST[ RSVP_PRO_OPTION_TURNSTILE_SECRET_KEY ];

	if ( ( $attendeelist_allow_checkin === 'Y' ) && ( $allow_checkin === 'N' ) ) {
		$allow_checkin = 'Y';
	}

	if ( isset( $_POST['adminRoles'] ) && is_array( $_POST['adminRoles'] ) ) {
		$adminRoles = $_POST['adminRoles'];
	} elseif ( ! empty( $_POST['adminRoles'] ) ) {
		$adminRoles = explode( ',', $_POST['adminRoles'] );
	}

	if ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER ] ) && is_array( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER ] ) ) {
		$attendeelistFilter = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER ];
	} elseif ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER ] ) &&
	           ! empty( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER ] ) ) {
		$attendeelistFilter = explode( ',', $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_FILTER ] );
	}

	$tmp = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SORT_ORDER ];
	if ( ( $tmp == 'firstName' ) ||
	     ( $tmp == 'lastName' ) ||
	     ( $tmp == 'rsvpStatus' ) ||
	     ( $tmp == 'rsvpDate' ) ||
	     ( strpos( $tmp, "cq_" ) !== false ) ) {
		$attendeelistSortOrder = $tmp;
	}

	if ( is_numeric( $_POST[ RSVP_PRO_OPTION_EVENT_COUNT_LIMIT ] ) && ( $_POST[ RSVP_PRO_OPTION_EVENT_COUNT_LIMIT ] > 0 ) ) {
		$rsvpLimit = $_POST[ RSVP_PRO_OPTION_EVENT_COUNT_LIMIT ];
	}

	if ( is_numeric( $_POST[ RSVP_PRO_OPTION_PASSWORD_LENGTH ] ) && ( $_POST[ RSVP_PRO_OPTION_PASSWORD_LENGTH ] >= 1 ) && ( $_POST[ RSVP_PRO_OPTION_PASSWORD_LENGTH ] <= 50 ) ) {
		$password_length = $_POST[ RSVP_PRO_OPTION_PASSWORD_LENGTH ];
	}

	$attendeeListCustomQs = array();
	if ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS ] ) && is_array( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS ] ) ) {
		$attendeeListCustomQs = $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS ];
	} elseif ( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS ] ) && ! empty( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS ] ) ) {
		$attendeeListCustomQs = explode( ',', $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_CUSTOM_QUESTIONS ] );
	}

	$roles_auto_enroll = array();
	if ( isset( $_POST[ RSVP_PRO_OPTION_AUTO_ENROLL_ROLE ] ) && is_array( $_POST[ RSVP_PRO_OPTION_AUTO_ENROLL_ROLE ] ) ) {
		$roles_auto_enroll = $_POST[ RSVP_PRO_OPTION_AUTO_ENROLL_ROLE ];
	} elseif ( isset( $_POST[ RSVP_PRO_OPTION_AUTO_ENROLL_ROLE ] ) && ! empty( $_POST[ RSVP_PRO_OPTION_AUTO_ENROLL_ROLE ] ) ) {
		$roles_auto_enroll = explode( ',', $_POST[ RSVP_PRO_OPTION_AUTO_ENROLL_ROLE ] );
	}

	$tmp = strtolower( $_POST[ RSVP_PRO_OPTION_REPEAT_FREQUENCY_TYPE ] );
	if ( ( $tmp == 'month' ) || ( $tmp == 'year' ) || ( $tmp == 'week' ) || ( $tmp == 'day' ) ) {
		$repeatFrequencyType = $tmp;
	}

	$tmp = strtolower( $_POST[ RSVP_PRO_OPTION_REPEAT_LENGTH_TYPE ] );
	if ( ( $tmp == 'month' ) || ( $tmp == 'year' ) || ( $tmp == 'week' ) || ( $tmp == 'day' ) ) {
		$repeatLengthType = $tmp;
	}

	if ( is_numeric( $_POST[ RSVP_PRO_OPTION_REPEAT_FREQUENCY ] ) && ( $_POST[ RSVP_PRO_OPTION_REPEAT_FREQUENCY ] > 0 ) ) {
		$repeatFrequency = (int) $_POST[ RSVP_PRO_OPTION_REPEAT_FREQUENCY ];
	}

	if ( is_numeric( $_POST[ RSVP_PRO_OPTION_REPEAT_LENGTH ] ) && ( $_POST[ RSVP_PRO_OPTION_REPEAT_LENGTH ] > 0 ) ) {
		$repeatLength = (int) $_POST[ RSVP_PRO_OPTION_REPEAT_LENGTH ];
	}

	$eventID = 0;

	if ( strtotime( $_POST['open_date'] ) ) {
		$opendate = date( 'Y-m-d', strtotime( $_POST['open_date'] ) );
	}

	if ( strtotime( $_POST['close_date'] ) ) {
		$closedate = date( 'Y-m-d', strtotime( $_POST['close_date'] ) );
	}

	if ( ! empty( $_POST['open_date_time_zone'] ) ) {
		$opendate_time_zone = $_POST['open_date_time_zone'];
	}

	if ( ! empty( $_POST['open_date_time'] ) ) {
		$opendate_time = $_POST['open_date_time'];
	}

	if ( ! empty( $_POST['close_date_time_zone'] ) ) {
		$closedate_time_zone = $_POST['close_date_time_zone'];
	}

	if ( ! empty( $_POST['close_date_time'] ) ) {
		$closedate_time = $_POST['close_date_time'];
	}

	if ( ! empty( $_POST['eventStartDateTimezone'] ) ) {
		$eventStartDateTimezone = $_POST['eventStartDateTimezone'];
	}

	if ( ! empty( $_POST['eventEndDateTimezone'] ) ) {
		$eventEndDateTimezone = $_POST['eventEndDateTimezone'];
	}

	// Will be used when displaying the time information in the event list
	$time_zone = new DateTimeZone( rsvp_pro_wp_get_timezone_string() );

	if ( strToTime( $_POST['eventStartDate'] ) ) {

		$tmp_date = new DateTime( $_POST['eventStartDate'], ( ! empty( $_POST['eventStartDateTimezone'] ) ? new DateTimeZone( RSVP_PRO_Admin_Helper::set_propper_date( $_POST['eventStartDateTimezone'] ) ) : $time_zone ) );

		// We do this in the case where we people specify a timezone as the DateTime object
		// will use that over the previously set timezone, so, we have to set it again
		if ( $tmp_date->getTimezone()->getName() != $time_zone->getName() ) {
			;
			$tmp_date->setTimeZone( $time_zone );
		}
		$tmp_date->setTimeZone( new DateTimeZone( 'UTC' ) );
		$eventStartDate = $tmp_date->format( 'Y-m-d H:i:s' );
	}

	if ( strToTime( $_POST['eventEndDate'] ) ) {

		$tmp_date = new DateTime( $_POST['eventEndDate'], ( ! empty( $_POST['eventEndDateTimezone'] ) ? new DateTimeZone( RSVP_PRO_Admin_Helper::set_propper_date( $_POST['eventEndDateTimezone'] ) ) : $time_zone ) );

		// We do this in the case where we people specify a timezone as the DateTime object
		// will use that over the previously set timezone, so, we have to set it again
		if ( $tmp_date->getTimezone()->getName() != $time_zone->getName() ) {
			;
			$tmp_date->setTimeZone( $time_zone );
		}
		$tmp_date->setTimeZone( new DateTimeZone( 'UTC' ) );
		$eventEndDate = $tmp_date->format( 'Y-m-d H:i:s' );
	}

	if ( is_numeric( $_POST['parentEventID'] ) && ( $_POST['parentEventID'] > 0 ) ) {
		$parentEventID = $_POST['parentEventID'];
	}

	if ( strtotime( $_POST[ RSVP_PRO_OPTION_REPEAT_START_DATE ] ) ) {
		$repeatStartDate = date( 'Y-m-d', strtotime( $_POST[ RSVP_PRO_OPTION_REPEAT_START_DATE ] ) );
	}

	if ( strtotime( $_POST[ RSVP_PRO_OPTION_REPEAT_END_DATE ] ) ) {
		$repeatEndDate = date( 'Y-m-d', strtotime( $_POST[ RSVP_PRO_OPTION_REPEAT_END_DATE ] ) );
	}

	$attendee_list_columns = array();

	if ( isset( $_POST['alc_attendee_name'] ) && ( $_POST['alc_attendee_name'] === 'Y' ) ) {
		$attendee_list_columns[] = 'attendee_name';
	}

	if ( isset( $_POST['alc_rsvp_status'] ) && ( $_POST['alc_rsvp_status'] === 'Y' ) ) {
		$attendee_list_columns[] = 'rsvp_status';
	}

	if ( isset( $_POST['alc_rsvp_date'] ) && ( $_POST['alc_rsvp_date'] === 'Y' ) ) {
		$attendee_list_columns[] = 'rsvp_date';
	}

	if ( isset( $_POST['alc_additional_attendee'] ) && ( $_POST['alc_additional_attendee'] === 'Y' ) ) {
		$attendee_list_columns[] = 'additional_attendee';
	}

	if ( isset( $_POST['alc_note'] ) && ( $_POST['alc_note'] === 'Y' ) ) {
		$attendee_list_columns[] = 'note';
	}

	if ( isset( $_POST['alc_associated_attendees'] ) && ( $_POST['alc_associated_attendees'] === 'Y' ) ) {
		$attendee_list_columns[] = 'associated_attendees';
	}

	if ( isset( $_POST['alc_email'] ) && ( $_POST['alc_email'] === 'Y' ) ) {
		$attendee_list_columns[] = 'email';
	}

	if ( isset( $_POST['alc_checked_in'] ) && ( $_POST['alc_checked_in'] === 'Y' ) ) {
		$attendee_list_columns[] = 'checked_in';
	}

	if ( isset( $_POST['alc_passcode'] ) && ( $_POST['alc_passcode'] === 'Y' ) ) {
		$attendee_list_columns[] = 'passcode';
	}

	if ( isset( $_POST['alc_alternate_passcode'] ) && ( $_POST['alc_alternate_passcode'] === 'Y' ) ) {
		$attendee_list_columns[] = 'alternate_passcode';
	}

	$options         = new Rsvp_Pro_Event_Options();
	$options->set_greeting_text( $greetingText );
	$options->set_welcome_text( $welcomeText );
	$options->set_thank_you_text( $thankYouText );
	$options->set_thank_you_redirect( $thank_you_redirect );
	$options->set_not_coming_redirect( $not_coming_redirect );
	$options->set_rsvp_yes_label( $rsvpYesLabel );
	$options->set_rsvp_no_label( $rsvpNoLabel );
	$options->set_rsvp_question_text( $rsvpQuestionText );
	$options->set_text_under_rsvp( $text_under_rsvp );
	$options->set_hide_additional_guests( $hideAdditionalGuests );
	$options->set_plus_one_enabled( $plus_one_enabled );
	$options->set_plus_one_label( $plus_one_label );
	$options->set_notify_user( $notifyUser );
	$options->set_notify_email( $notifyEmail );
	$options->set_require_passcode( $requirePasscode );
	$options->set_unique_passcode( $unique_passcode );
	$options->set_passcode_editable( $passcode_editable );
	$options->set_passcode_editable_label( $passcode_editable_label );
	$options->set_first_name_js_message( $first_name_js_message );
	$options->set_last_name_js_message( $last_name_js_message );
	$options->set_note_js_message( $note_js_message );
	$options->set_email_js_message( $email_js_message );
	$options->set_gdpr_js_message( $gdpr_js_message );
	$options->set_unique_passcode_js_message( $unique_passcode_js_message );
	$options->set_unique_email_js_message( $unique_email_js_message );
	$options->set_hide_note( $hideNote );
	$options->set_additional_note_label( $additionalNoteLabel );
	$options->set_rsvp_open_reg( $rsvpOpenReg );
	$options->set_rsvp_hide_search_form( $hide_search_form );
	$options->set_display_search_button_text( $display_search_button_text );
	$options->set_rsvp_prompt_to_add_not_found( $rsvp_open_prompt_to_add );
	$options->set_rsvp_prompt_to_add_not_found_text( $rsvp_open_prompt_to_add_text );
	$options->set_dont_use_hash( $dontUseHash );
	$options->set_add_additional_text( $addAdditionalText );
	$options->set_guest_email_confirm( $guestEmailConfirm );
	$options->set_num_additional_guests( $numAdditionalGuests );
	$options->set_hide_email_field( $hideEmailField );
	$options->set_unique_email_validation( $unique_email_validation );
	$options->set_disable_custom_email_from( $disableCustomEmailFrom );
	$options->set_only_passcode( $onlyPasscode );
	$options->set_rsvp_email_text( $rsvpEmailText );
	$options->set_rsvp_no_editing( $rsvpNoEditing );
	$options->set_rsvp_no_edit_prompt( $rsvp_no_edit_prompt );
	$options->set_rsvp_only_once( $rsvp_only_once );
	$options->set_rsvp_only_once_text( $rsvp_only_once_text );
	$options->set_rsvp_disable_user_search( $rsvpDisableUserSearch );
	$options->set_not_coming_verbiage( $notComingVerbiage );
	$options->set_thankyou_modify_text( $thankyou_modify_text );
	$options->set_thankyou_password_text( $thankyou_password_text );
	$options->set_thankyou_associated_text( $thankyou_associated_text );
	$options->set_show_salutation( $showSalutation );
	$options->set_show_suffix( $showSuffix );
	$options->set_salutations( $salutations );
	$options->set_password_length( $password_length );
	$options->set_show_no_response( $showNoResponse );
	$options->set_require_email( $requireEmail );
	$options->set_require_rsvp_values( $requireRsvpValues );
	$options->set_hide_rsvp( $hide_rsvp );
	$options->set_hide_welcome( $hide_welcome_text );
	$options->set_hide_rsvp_question( $hide_main_rsvp_question );
	$options->set_default_rsvp_value( $default_rsvp_value );
	$options->set_no_passcode_on_open( $noPasscodeOnOpen );
	$options->set_frontend_wizard( $frontendWizard );
	$options->set_new_attendee_button_text( $newAttendeeButtonText );
	$options->set_rsvp_frontend_button_text( $rsvpFrontendButtonText );
	$options->set_next_button_text( $nextButtonText );
	$options->set_rsvp_limit( $rsvpLimit );
	$options->set_rsvp_limit_text( $rsvpLimitText );
	$options->set_rsvp_enable_waitlist( $rsvpEnableWaitlist );
	$options->set_rsvp_enable_maybe( $rsvp_enable_maybe );
	$options->set_rsvp_waitlist_text( $rsvpWaitlistText );
	$options->set_open_date_text( $openDateText );
	$options->set_close_date_text( $closeDateText );
	$options->set_rsvp_waitlist_label( $rsvpWaitlistLabel );
	$options->set_rsvp_maybe_label( $rsvp_maybe_label );
	$options->set_attendeelist_filter( $attendeelistFilter );
	$options->set_attendeelist_sort_order( $attendeelistSortOrder );
	$options->set_attendeelist_hide_status( $attendeeListHideStatus );
	$options->set_attendeelist_custom_qs( $attendeeListCustomQs );
	$options->set_attendee_auto_login( $attendeeAutoLogin );
	$options->set_modify_registration_text( $modifyRegistrationText );
	$options->set_add_attendee_button_text( $addAttendeeButtonText );
	$options->set_admin_roles( $adminRoles );
	$options->set_email_from( $emailFrom );
	$options->set_email_cc_associated( $emailCCAssociated );
	$options->set_email_associated_individually( $email_associated_individually );
	$options->set_email_bcc_addresses( $emailBCCAddresses );
	$options->set_email_subject( $emailSubject );
	$options->set_admin_email_subject( $admin_email_subject );
	$options->set_admin_email_body( $admin_email_body );
	$options->set_email_body( $email_body );
	$options->set_no_email_body( $no_email_body );
	$options->set_maybe_email_body( $maybe_email_body );
	$options->set_waitlist_email_body( $waitlist_email_body );
	$options->set_email_include_ics( $email_include_ics );
	$options->set_first_name_label( $firstNameLabel );
	$options->set_last_name_label( $lastNameLabel );
	$options->set_complete_button_text( $completeButtonText );
	$options->set_passcode_label( $passcodeLabel );
	$options->set_edit_prompt_text( $editPromptText );
	$options->set_suffix_label( $suffixLabel );
	$options->set_salutation_label( $salutationLabel );
	$options->set_email_label( $emailLabel );
	$options->set_associated_message( $associatedMessage );
	$options->set_associated_greeting( $associatedGreeting );
	$options->set_multi_option_text( $multiOptionText );
	$options->set_multi_event_title( $multiEventTitle );
	$options->set_remove_attendee_button( $removeAttendeeButton );
	$options->set_yes_text( $yesText );
	$options->set_maybe_text( $maybe_text );
	$options->set_plus_one_text( $plus_one_text );
	$options->set_no_text( $noText );
	$options->set_hi_text( $hi_text );
	$options->set_no_response_text( $noResponseText );
	$options->set_multiple_matches_text( $multipleMatchesText );
	$options->set_multiple_attendee_text( $multiple_attendee_text );
	$options->set_fuzzy_match_text( $fuzzyMatchText );
	$options->set_welcome_back_text( $welcomeBackText );
	$options->set_unable_find_text( $unableFindText );
	$options->set_partial_user_search( $partialUserSearch );
	$options->set_last_name_not_required( $lastNameNotRequired );
	$options->set_auto_waitlist_to_yes( $autoWaitlistToYes );
	$options->set_waitlist_yes_unavailable( $waitlistYesUnavailable );
	$options->set_waitlist_perm_switch( $waitlistPermSwitch );
	$options->set_waitlist_status_email( $waitlistStatusEmail );
	$options->set_show_calendar_link( $showCalendarLink );
	$options->set_calendar_link_text( $calendarLinkText );
	$options->set_google_calendar_link_text( $google_calendar_link_text );
	$options->set_additional_attendee_text( $additionalAttendeeText );
	$options->set_repeat_do_not_save_event( $repeatDoNotSaveEvent );
	$options->set_use_email_for_lookup( $useEmailForLookup );
	$options->set_show_event_info( $showEventInfo );
	$options->set_attendee_list_allow_rsvp( $attendeeListAllowRsvp );
	$options->set_attendee_list_export_button( $attendee_list_export_button );
	$options->set_attendee_list_page_size( $attendee_list_page_size );
	$options->set_send_attendee_list_note( $sendAttendeeListNote );
	$options->set_send_attendee_list_email( $sendAttendeeListEmail );
	$options->set_send_attendee_list_format( $sendAttendeeListFormat );
	$options->set_first_last_editable( $first_last_editable );
	$options->set_roles_auto_enroll( $roles_auto_enroll );
	$options->set_attendee_list_show_search( $attendeelist_show_search );
	$options->set_attendee_list_search_text( $attendeelist_search_text );
	$options->set_attendee_list_allow_checkin( $attendeelist_allow_checkin );
	$options->set_allow_checkin( $allow_checkin );
	$options->set_attendee_list_checkin_text( $attendeelist_checkin_text );
	$options->set_attendee_list_checked_in_text( $attendeelist_checked_in_text );
	$options->set_attendee_list_show_email( $attendee_list_show_email );
	$options->set_attendee_list_show_note( $attendee_list_show_note );
	$options->set_attendee_list_show_summary( $attendee_list_show_summary );
	$options->set_attendee_list_show_associated( $attendee_list_show_associated );
	$options->set_show_gdpr_question( $show_gdpr_question );
	$options->set_gdpr_question_text( $gdpr_question_text );
	$options->set_enable_recaptcha( $enable_recaptcha );
	$options->set_recaptcha_site_key( $recaptcha_site_key );
	$options->set_recaptcha_secret_key( $recaptcha_secret_key );
	$options->set_enable_ajax( $enable_ajax );
	$options->set_show_new_attendee_form_first( $show_new_attendee_form_first );
	$options->set_find_attendees_link_text( $find_attendee_link_text );
	$options->set_waitlist_friendly_text( $waitlist_friendly_text );
	$options->set_rsvp_form_url( $rsvp_form_url );
	$options->set_ticket_price( $_POST[ RSVP_PRO_OPTION_TICKET_PRICE ] );
	$options->set_form_show_profile_pic( $form_show_profile_pic );
	$options->set_attendee_list_show_profile_pic( $attendee_list_show_profile_pic );
	$options->set_always_show_additional( $always_show_additional );
	$options->set_enable_payments( isset( $_POST[ RSVP_PRO_OPTION_ENABLE_PAYMENTS ] ) ? $_POST[ RSVP_PRO_OPTION_ENABLE_PAYMENTS ] : 'N' );
	$options->set_payment_testing( isset( $_POST[ RSVP_PRO_OPTION_PAYMENT_IN_TESTING ] ) ? $_POST[ RSVP_PRO_OPTION_PAYMENT_IN_TESTING ] : 'N' );
	$options->set_currency( $_POST[ RSVP_PRO_OPTION_CURRENCY ] );
	$options->set_currency_position( $_POST[ RSVP_PRO_OPTION_CURRENCY_POSITION ] );
	$options->set_thousands_separator( $_POST[ RSVP_PRO_OPTION_THOUSANDS_SEPARATOR ] );
	$options->set_decimal_separator( $_POST[ RSVP_PRO_OPTION_DECIMAL_SEPARATOR ] );
	$options->set_payment_message( $_POST[ RSVP_PRO_OPTION_PAYMENT_MESSAGE ] );
	$options->set_payment_success_url( $_POST[ RSVP_PRO_OPTION_PAYMENT_SUCCESS_URL ] );
	$options->set_payment_failure_url( $_POST[ RSVP_PRO_OPTION_PAYMENT_FAILURE_URL ] );
	$options->set_payment_description( $_POST[ RSVP_PRO_OPTION_PAYMENT_DESCRIPTION ] );
	$options->set_full_name_search( isset( $_POST[ RSVP_PRO_OPTION_FULL_NAME_SEARCH ] ) ? $_POST[ RSVP_PRO_OPTION_FULL_NAME_SEARCH ] : 'N' );
	$options->set_name_label( $_POST[ RSVP_PRO_OPTION_NAME_LABEL ] );
	$options->set_attendee_list_show_qr_prefill( isset( $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_QR_PREFILL ] ) ? $_POST[ RSVP_PRO_OPTION_ATTENDEE_LIST_SHOW_QR_PREFILL ] : 'N' );
	$options->set_enable_turnstile( $enable_turnstile );
	$options->set_turnstile_site_key( $turnstile_site_key );
	$options->set_turnstile_secret_key( $turnstile_secret_key );

	$url_ending = 'add=success';

	if ( isset( $_POST['eventID'] ) && is_numeric( $_POST['eventID'] ) && ( $_POST['eventID'] > 0 ) ) {
		$sql       = "SELECT id FROM " . PRO_QUESTIONS_TABLE . " WHERE rsvpEventID = %d";
		$questions = $wpdb->get_results( $wpdb->prepare( $sql, $_POST['eventID'] ) );
		foreach ( $questions as $q ) {
			if ( isset( $_POST[ 'alc_custom_question_' . $q->id ] ) && ( $_POST[ 'alc_custom_question_' . $q->id ] === 'Y' ) ) {
				$attendee_list_columns[] = 'custom_question_' . $q->id;
			}
		}

		$tmp_options = new Rsvp_Pro_Event_Options( $_POST['eventID'] );
		$options->set_export_columns( $tmp_options->get_export_columns() );

		$wpdb->update(
			PRO_EVENT_TABLE,
			array(
				'eventName'              => $eventName,
				'open_date'              => $opendate,
				'close_date'             => $closedate,
				'parentEventID'          => $parentEventID,
				'event_access'           => $eventAccess,
				'eventStartDate'         => $eventStartDate,
				'eventStartDateTimezone' => $eventStartDateTimezone,
				'eventEndDate'           => $eventEndDate,
				'eventEndDateTimezone'   => $eventEndDateTimezone,
				'eventLocation'          => $eventLocation,
				'eventDescription'       => $eventDescription,
				'repeatStartDate'        => $repeatStartDate,
				'repeatEndDate'          => $repeatEndDate,
				'repeatFrequency'        => $repeatFrequency,
				'repeatFrequencyType'    => $repeatFrequencyType,
				'eventLength'            => $repeatLength,
				'eventLengthType'        => $repeatLengthType,
				'open_date_timezone'     => $opendate_time_zone,
				'open_date_time'         => $opendate_time,
				'close_date_timezone'    => $closedate_time_zone,
				'close_date_time'        => $closedate_time,
				'send_attendee_list'     => $sendAttendeeList,
				'attendee_columns'       => implode( ',', $attendee_list_columns ),
			),
			array( 'id' => $_POST['eventID'] ),
			array(
				'%s', // eventName.
				'%s', // open_date.
				'%s', // close_date.
				'%d', // parentEventID.
				'%s', // event_access.
				'%s', // eventStartDate.
				'%s', // eventStartDateTimezone.
				'%s', // eventEndDate.
				'%s', // eventEndDateTimezone.
				'%s', // eventLocation.
				'%s', // eventDescription.
				'%s', // repeatStartDate.
				'%s', // repeatEndDate.
				'%d', // repeatFrequency.
				'%s', // repeatFrequencyType.
				'%d', // eventLength.
				'%s', // eventLengthType.
				'%s', // open_date_timezone.
				'%s', // open_date_time.
				'%s', // close_date_timezone.
				'%s', // close_date_time.
				'%s', // send_attendee_list.
				'%s', // attendee_columns.
			),
			array( '%d' )
		);

		if ( 'Y' === $requirePasscode ) {
			rsvp_pro_set_passcode( $_POST['eventID'] );
		}

		// Save the access....
		$wpdb->delete( PRO_EVENT_ATTENDEE_TABLE, array( 'rsvpEventID' => $_POST['eventID'] ) );
		$tmpAttendeeAccess = array();
		if ( isset( $_POST['attendeeAccess'] ) && ! is_array( $_POST['attendeeAccess'] ) ) {
			$tmpAttendeeAccess = explode( ',', $_POST['attendeeAccess'] );
		} elseif ( isset( $_POST['attendeeAccess'] ) ) {
			$tmpAttendeeAccess = $_POST['attendeeAccess'];
		}
		foreach ( $tmpAttendeeAccess as $aid ) {
			if ( is_numeric( $aid ) && ( $aid > 0 ) ) {
				$wpdb->insert( PRO_EVENT_ATTENDEE_TABLE, array(
					'rsvpAttendeeID' => $aid,
					'rsvpEventID'    => $_POST['eventID']
				), array( '%d', '%d' ) );
			}
		}
		$eventId    = $_POST['eventID'];
		$url_ending = 'edit=success';
	} else {
		// new event
		$wpdb->insert(
			PRO_EVENT_TABLE,
			array(
				'eventName'              => $eventName,
				'open_date'              => $opendate,
				'close_date'             => $closedate,
				'parentEventID'          => $parentEventID,
				'event_access'           => $eventAccess,
				'eventStartDate'         => $eventStartDate,
				'eventStartDateTimezone' => $eventStartDateTimezone,
				'eventEndDate'           => $eventEndDate,
				'eventEndDateTimezone'   => $eventEndDateTimezone,
				'eventLocation'          => $eventLocation,
				'eventDescription'       => $eventDescription,
				'repeatStartDate'        => $repeatStartDate,
				'repeatEndDate'          => $repeatEndDate,
				'repeatFrequency'        => $repeatFrequency,
				'repeatFrequencyType'    => $repeatFrequencyType,
				'eventLength'            => $repeatLength,
				'eventLengthType'        => $repeatLengthType,
				'open_date_time'         => $opendate_time,
				'open_date_timezone'     => $opendate_time_zone,
				'close_date_time'        => $closedate_time,
				'close_date_timezone'    => $closedate_time_zone,
				'send_attendee_list'     => $sendAttendeeList,
				'attendee_columns'       => implode( ',', $attendee_list_columns ),
			),
			array(
				'%s', // eventName
				'%s', // open_date
				'%s', // close_date
				'%d', // parentEventID
				'%s', // event_access
				'%s', // eventStartDate
				'%s', // eventStartDateTimezone
				'%s', // eventEndDate
				'%s', // eventEndDateTimezone
				'%s', // eventLocation
				'%s', // eventDescription
				'%s', // repeatStartDate
				'%s', // repeatEndDate
				'%d', // repeatFrequency
				'%s', // repeatFrequencyType
				'%d', // eventLength
				'%s', // eventLengthType
				'%s', // open_date_time
				'%s', // open_date_timezone
				'%s', // close_date_time
				'%s', // close_date_timezone
				'%s', // send_attendee_list
				'%s', // attendee_columns
			)
		);
		$eventId = $wpdb->insert_id;
		if ( $requirePasscode == 'Y' ) {
			rsvp_pro_set_passcode( $eventId );
		}

		// Save the access....
		$wpdb->delete( PRO_EVENT_ATTENDEE_TABLE, array( 'rsvpEventID' => $eventId ) );
		$tmpAttendeeAccess = array();
		if ( isset( $_POST['attendeeAccess'] ) && ! is_array( $_POST['attendeeAccess'] ) ) {
			$tmpAttendeeAccess = explode( ',', $_POST['attendeeAccess'] );
		} else if ( isset( $_POST['attendeeAccess'] ) ) {
			$tmpAttendeeAccess = $_POST['attendeeAccess'];
		}
		foreach ( $tmpAttendeeAccess as $aid ) {
			if ( is_numeric( $aid ) && ( $aid > 0 ) ) {
				$wpdb->insert( PRO_EVENT_ATTENDEE_TABLE, array(
					'rsvpAttendeeID' => $aid,
					'rsvpEventID'    => $eventId
				), array( '%d', '%d' ) );
			}
		}
	}

	$options->set_event_id( $eventId );
	$options->save_options();

	$comment_status = 'open';
	if ( get_option( RSVP_PRO_GLOBAL_OPTION_DISABLE_COMMENTS ) == 'Y' ) {
		$comment_status = 'closed';
	}

	if ( get_option( RSVP_PRO_GLOBAL_OPTION_AUTO_CREATE_ATTENDEE_LIST ) == 'Y' ) {
		// Get the page that is linked....
		// We don't do a search for a closing bracket because people can add in additional
		// attributes for the attendee list
		$queryString = array(
			"s"        => '[rsvppro-attendeelist id="' . $eventId . '"',
			"sentence" => 1
		);
		$query       = new WP_Query( $queryString );
		$url         = "";
		if ( ! $query->have_posts() ) {
			$post_content = '[rsvppro-attendeelist id="' . $eventId . '"]';
			$post_type    = 'page';
			if ( get_option( RSVP_PRO_GLOBAL_OPTION_AUTO_POST_TYPE ) != '' ) {
				$post_type = get_option( RSVP_PRO_GLOBAL_OPTION_AUTO_POST_TYPE );
			}

			$args = array(
				'post_content'   => $post_content,
				'post_title'     => rsvp_pro_get_event_name( $eventId ) . ' ' . rsvp_pro_get_admin_string( 'attendee_list_text' ),
				'post_status'    => 'publish',
				'comment_status' => $comment_status,
				'post_type'      => $post_type,
			);

			$result = wp_insert_post( $args );
		}
		wp_reset_postdata();
	}

	if ( get_option( RSVP_PRO_GLOBAL_OPTION_AUTO_CREATE_PAGE ) == "Y" ) {
		// Get the page that is linked....
		$queryString = array(
			"s"        => '[rsvppro id="' . $eventId . '"]',
			"sentence" => 1
		);
		$query       = new WP_Query( $queryString );
		$url         = "";
		if ( ! $query->have_posts() ) {
			$post_content = '[rsvppro id="' . $eventId . '"]';

			if ( get_option( RSVP_PRO_GLOBAL_OPTION_ADD_ATTENDEE_LIST_TO_PAGE ) == 'Y' ) {
				$post_content .= "\r\n" . '[rsvppro-attendeelist id="' . $eventId . '"]';
			}

			$post_type = 'page';
			if ( get_option( RSVP_PRO_GLOBAL_OPTION_AUTO_POST_TYPE ) != '' ) {
				$post_type = get_option( RSVP_PRO_GLOBAL_OPTION_AUTO_POST_TYPE );
			}

			$args = array(
				'post_content'   => $post_content,
				'post_title'     => rsvp_pro_get_event_name( $eventId ),
				'post_status'    => 'publish',
				'comment_status' => $comment_status,
				'post_type'      => $post_type,
			);

			$result = wp_insert_post( $args );
		}
		wp_reset_postdata();
	}

	wp_redirect( admin_url( 'admin.php?page=rsvp-pro-admin-manage-event&id=' . $eventId . '&' . $url_ending ) );
	exit;
}
if ( isset( $_GET['id'] ) && is_numeric( $_GET['id'] ) && ( $_GET['id'] > 0 ) ) {
	$sql = 'SELECT eventName, open_date, close_date, options, parentEventID,
                    event_access, eventStartDate, eventEndDate, eventLocation, eventDescription,
                    repeatStartDate, repeatEndDate, repeatFrequencyType, repeatFrequency,
                    eventLength, eventLengthType, open_date_timezone, open_date_time,
					close_date_timezone, close_date_time, send_attendee_list, attendee_list_sent_on, 
                    attendee_columns, eventStartDateTimezone, eventEndDateTimezone
              FROM ' . PRO_EVENT_TABLE . ' WHERE id = %d';

	$event = $wpdb->get_row( $wpdb->prepare( $sql, $_GET['id'] ) );
	$rsvp_pro_helper = new RSVP_PRO_Admin_Helper();
	if ( $event ) {
		$buttonText                    = rsvp_pro_get_admin_string( 'update_event_button_label' );
		$eventID                       = $_GET['id'];
		$attendee_default_list_columns = rsvp_pro_default_attendee_list_columns( $eventID );
		$attendee_lists                = $rsvp_pro_helper->get_event_attendee_columns( $_GET['id'] );
		$attendee_lists_columns        = ( $attendee_lists ) ? $attendee_lists : $attendee_default_list_columns;
		$options                       = new Rsvp_Pro_Event_Options( $eventID );
		$event_options                 = $options;
		$hasMultipleEvents             = rsvp_pro_is_sub_or_parent_event( $eventID );
		$eventName                     = stripslashes( $event->eventName );
		$eventStartDateTimezone        = stripslashes( $event->eventStartDateTimezone );
		$eventEndDateTimezone          = stripslashes( $event->eventEndDateTimezone );

		if ( strtotime( $event->open_date ) && ( $event->open_date != '0000-00-00' ) ) {
			$opendate = date( 'm/d/Y', strtotime( $event->open_date ) );
		}

		if ( strtotime( $event->close_date ) && ( $event->close_date != '0000-00-00' ) ) {
			$closedate = date( 'm/d/Y', strtotime( $event->close_date ) );
		}
		if ( strtotime( $event->eventStartDate ) && ( $event->eventStartDate != '0000-00-00 00:00:00' ) ) {
			$time_zone = new DateTimeZone( rsvp_pro_wp_get_timezone_string() );
			$tmp_date  = new DateTime( $event->eventStartDate, new DateTimeZone( 'UTC' ) );

			$tmp_date->setTimeZone( $time_zone );

			if ( ! empty( $eventStartDateTimezone ) ) {

				
				$tmp_time_zone = new DateTimeZone(RSVP_PRO_Admin_Helper::set_propper_date( $eventStartDateTimezone ) );
				$tmp_date->setTimeZone( $tmp_time_zone );
			}

			$eventStartDate = $tmp_date->format( 'Y-m-d H:i:s' );
		}

		if ( strtotime( $event->eventEndDate ) && ( $event->eventEndDate != '0000-00-00 00:00:00' ) ) {
			$time_zone = new DateTimeZone( rsvp_pro_wp_get_timezone_string() );
			$tmp_date  = new DateTime( $event->eventEndDate, new DateTimeZone( 'UTC' ) );
			$tmp_date->setTimeZone( $time_zone );

			if ( ! empty( $eventEndDateTimezone ) ) {

				$tmp_time_zone = new DateTimeZone( RSVP_PRO_Admin_Helper::set_propper_date( $eventEndDateTimezone ) );
				$tmp_date->setTimeZone( $tmp_time_zone );
			}

			$eventEndDate = $tmp_date->format( 'Y-m-d H:i:s' );
		}

		if ( strtotime( $event->repeatStartDate ) && ( $event->repeatStartDate != '0000-00-00' ) ) {
			$repeatStartDate = date_i18n( get_option( 'date_format' ), strtotime( $event->repeatStartDate ) );
		}

		if ( strtotime( $event->repeatEndDate ) && ( $event->repeatEndDate != '0000-00-00' ) ) {
			$repeatEndDate = date_i18n( get_option( 'date_format' ), strtotime( $event->repeatEndDate ) );
		}

		if ( isset( $event->attendee_list_sent_on ) && strtotime( $event->attendee_list_sent_on ) ) {
			$attendee_list_sent_on = date_i18n(
				get_option( 'date_format' ) . ' ' . get_option( 'time_format' ),
				strtotime( $event->attendee_list_sent_on )
			);
		}

		if ( strToUpper( $event->send_attendee_list ) === 'Y' ) {
			$sendAttendeeList = 'Y';
		}

		if ( ! empty( $event->attendee_columns ) ) {
			$attendee_list_columns = explode( ",", stripslashes( $event->attendee_columns ) );
		}

		$opendate_time       = stripslashes( $event->open_date_time );
		$opendate_time_zone  = stripslashes( $event->open_date_timezone );
		$closedate_time      = stripslashes( $event->close_date_time );
		$closedate_time_zone = stripslashes( $event->close_date_timezone );
		$repeatFrequency     = $event->repeatFrequency;
		$repeatFrequencyType = $event->repeatFrequencyType;
		$repeatLength        = $event->eventLength;
		$repeatLengthType    = $event->eventLengthType;
		$eventLocation       = stripslashes( $event->eventLocation );
		$eventDescription    = stripslashes( $event->eventDescription );
		$eventAccess         = ( $event->event_access == RSVP_PRO_PRIVATE_EVENT_ACCESS ) ? RSVP_PRO_PRIVATE_EVENT_ACCESS : RSVP_PRO_OPEN_EVENT_ACCESS;

		$parentEventID                 = $event->parentEventID;
		$greetingText                  = $options->get_greeting_text();
		$welcomeText                   = $options->get_welcome_text();
		$rsvpQuestionText              = $options->get_rsvp_question_text();
		$rsvpYesLabel                  = $options->get_rsvp_yes_label();
		$rsvpNoLabel                   = $options->get_rsvp_no_label();
		$additionalNoteLabel           = $options->get_additional_note_label();
		$text_under_rsvp               = $options->get_text_under_rsvp();
		$plus_one_label                = $options->get_plus_one_label();
		$plus_one_enabled              = $options->get_plus_one_enabled();
		$thankYouText                  = $options->get_thank_you_text();
		$thank_you_redirect            = $options->get_thank_you_redirect();
		$not_coming_redirect           = $options->get_not_coming_redirect();
		$hideAdditionalGuests          = $options->get_hide_additional_guests();
		$notifyUser                    = $options->get_notify_user();
		$notifyEmail                   = $options->get_notify_email();
		$requirePasscode               = $options->get_require_passcode();
		$unique_passcode               = $options->get_unique_passcode();
		$passcode_editable             = $options->get_passcode_editable();
		$passcode_editable_label       = $options->get_passcode_editable_label();
		$first_name_js_message         = $options->get_first_name_js_message();
		$last_name_js_message          = $options->get_last_name_js_message();
		$note_js_message               = $options->get_note_js_message();
		$email_js_message              = $options->get_email_js_message();
		$gdpr_js_message               = $options->get_gdpr_js_message();
		$unique_passcode_js_message    = $options->get_unique_passcode_js_message();
		$unique_email_js_message       = $options->get_unique_email_js_message();
		$hideNote                      = $options->get_hide_note();
		$rsvpOpenReg                   = $options->get_rsvp_open_reg();
		$hide_search_form              = $options->get_rsvp_hide_search_form();
		$display_search_button_text    = $options->get_display_search_form_text();
		$rsvp_open_prompt_to_add       = $options->get_rsvp_prompt_to_add_not_found();
		$rsvp_open_prompt_to_add_text  = $options->get_rsvp_prompt_to_add_not_found_text();
		$dontUseHash                   = $options->get_dont_use_hash();
		$addAdditionalText             = $options->get_add_additional_text();
		$guestEmailConfirm             = $options->get_guest_email_confirm();
		$numAdditionalGuests           = $options->get_num_additional_guests();
		$hideEmailField                = $options->get_hide_email_field();
		$unique_email_validation       = $options->get_unique_email_validation();
		$disableCustomEmailFrom        = $options->get_disable_custom_email_from();
		$onlyPasscode                  = $options->get_only_passcode();
		$rsvpEmailText                 = $options->get_rsvp_email_text();
		$rsvpNoEditing                 = $options->get_rsvp_no_editing();
		$rsvp_no_edit_prompt           = $options->get_rsvp_no_edit_prompt();
		$rsvp_only_once                = $options->get_rsvp_only_once();
		$rsvp_only_once_text           = $options->get_rsvp_only_once_text();
		$rsvpDisableUserSearch         = $options->get_rsvp_disable_user_search();
		$notComingVerbiage             = $options->get_not_coming_verbiage();
		$thankyou_modify_text          = $options->get_thankyou_modify_text();
		$thankyou_password_text        = $options->get_thankyou_password_text();
		$thankyou_associated_text      = $options->get_thankyou_associated_text();
		$showSalutation                = $options->get_show_salutation();
		$showSuffix                    = $options->get_show_suffix();
		$showNoResponse                = $options->get_show_no_response();
		$requireEmail                  = $options->get_require_email();
		$noPasscodeOnOpen              = $options->get_no_passcode_on_open();
		$requireRsvpValues             = $options->get_require_rsvp_values();
		$hide_rsvp                     = $options->get_hide_rsvp();
		$hide_main_rsvp_question       = $options->get_hide_rsvp_question();
		$hide_welcome_text             = $options->get_hide_welcome();
		$default_rsvp_value            = $options->get_default_rsvp_value();
		$frontendWizard                = $options->get_frontend_wizard();
		$newAttendeeButtonText         = $options->get_new_attendee_button_text();
		$rsvpFrontendButtonText        = $options->get_rsvp_frontend_button_text();
		$nextButtonText                = $options->get_next_button_text();
		$rsvpLimit                     = $options->get_rsvp_limit();
		$rsvpLimitText                 = $options->get_rsvp_limit_text();
		$rsvpEnableWaitlist            = $options->get_rsvp_enable_waitlist();
		$rsvp_enable_maybe             = $options->get_rsvp_enable_maybe();
		$rsvpWaitlistText              = $options->get_rsvp_waitlist_text();
		$openDateText                  = $options->get_open_date_text();
		$closeDateText                 = $options->get_close_date_text();
		$rsvpWaitlistLabel             = $options->get_rsvp_waitlist_label();
		$rsvp_maybe_label              = $options->get_rsvp_maybe_label();
		$attendeelistFilter            = $options->get_attendeelist_filter();
		$attendeelistSortOrder         = $options->get_attendeelist_sort_order();
		$attendeeListHideStatus        = $options->get_attendeelist_hide_status();
		$attendeeAutoLogin             = $options->get_attendee_auto_login();
		$modifyRegistrationText        = $options->get_modify_registration_text();
		$addAttendeeButtonText         = $options->get_add_attendee_button_text();
		$emailFrom                     = $options->get_email_from();
		$emailCCAssociated             = $options->get_email_cc_associated();
		$email_associated_individually = $options->get_email_associated_individually();
		$emailBCCAddresses             = $options->get_email_bcc_addresses();
		$emailSubject                  = $options->get_email_subject();
		$admin_email_subject           = $options->get_admin_email_subject();
		$admin_email_body              = $options->get_admin_email_body();
		$email_body                    = $options->get_email_body();
		$no_email_body                 = $options->get_no_email_body();
		$maybe_email_body              = $options->get_maybe_email_body();
		$waitlist_email_body           = $options->get_waitlist_email_body();
		$email_include_ics             = $options->get_email_include_ics();
		$firstNameLabel                = $options->get_first_name_label();
		$lastNameLabel                 = $options->get_last_name_label();
		$completeButtonText            = $options->get_complete_button_text();
		$passcodeLabel                 = $options->get_passcode_label();
		$editPromptText                = $options->get_edit_prompt_text();
		$suffixLabel                   = $options->get_suffix_label();
		$salutationLabel               = $options->get_salutation_label();
		$emailLabel                    = $options->get_email_label();
		$associatedMessage             = $options->get_associated_message();
		$associatedGreeting            = $options->get_associated_greeting();
		$multiEventTitle               = $options->get_multi_event_title();
		$multiOptionText               = $options->get_multi_option_text();
		$removeAttendeeButton          = $options->get_remove_attendee_button();
		$yesText                       = $options->get_yes_text();
		$noText                        = $options->get_no_text();
		$maybe_text                    = $options->get_maybe_text();
		$plus_one_text                 = $options->get_plus_one_text();
		$hi_text                       = $options->get_hi_text();
		$noResponseText                = $options->get_no_response_text();
		$multipleMatchesText           = $options->get_multiple_matches_text();
		$multiple_attendee_text        = $options->get_multiple_attendee_text();
		$fuzzyMatchText                = $options->get_fuzzy_match_text();
		$welcomeBackText               = $options->get_welcome_back_text();
		$unableFindText                = $options->get_unable_find_text();
		$partialUserSearch             = $options->get_partial_user_search();
		$lastNameNotRequired           = $options->get_last_name_not_required();
		$autoWaitlistToYes             = $options->get_auto_waitlist_to_yes();
		$waitlistYesUnavailable        = $options->get_waitlist_yes_unavailable();
		$waitlistPermSwitch            = $options->get_waitlist_perm_switch();
		$waitlistStatusEmail           = $options->get_waitlist_status_email();
		$showCalendarLink              = $options->get_show_calendar_link();
		$calendarLinkText              = $options->get_calendar_link_text();
		$google_calendar_link_text     = $options->get_google_calendar_link_text();
		$additionalAttendeeText        = $options->get_additional_attendee_text();
		$repeatDoNotSaveEvent          = $options->get_repeat_do_not_save_event();
		$useEmailForLookup             = $options->get_use_email_for_lookup();
		$showEventInfo                 = $options->get_show_event_info();
		$attendeeListAllowRsvp         = $options->get_attendee_list_allow_rsvp();
		$attendee_list_export_button   = $options->get_attendee_list_export_button();
		$attendee_list_page_size       = $options->get_attendee_list_page_size();
		$sendAttendeeListNote          = $options->get_send_attendee_list_note();
		$sendAttendeeListFormat        = $options->get_send_attendee_list_format();
		$sendAttendeeListEmail         = $options->get_send_attendee_list_email();
		$first_last_editable           = $options->get_first_last_editable();
		$allow_checkin                 = $options->get_allow_checkin();
		$attendeelist_show_search      = $options->get_attendee_list_show_search();
		$attendeelist_search_text      = $options->get_attendee_list_search_text();
		$attendeelist_checkin_text     = $options->get_attendee_list_checkin_text();
		$attendeelist_checked_in_text  = $options->get_attendee_list_checked_in_text();
		$attendeelist_allow_checkin    = $options->get_attendee_list_allow_checkin();
		$attendee_list_show_email      = $options->get_attendee_list_show_email();
		$attendee_list_show_note       = $options->get_attendee_list_show_note();
		$attendee_list_show_summary    = $options->get_attendee_list_show_summary();
		$attendee_list_show_associated = $options->get_attendee_list_show_associated();
		$show_gdpr_question            = $options->get_show_gdpr_question();
		$gdpr_question_text            = $options->get_gdpr_question_text();
		$enable_recaptcha              = $options->get_enable_recaptcha();
		$recaptcha_site_key            = $options->get_recaptcha_site_key();
		$recaptcha_secret_key          = $options->get_recaptcha_secret_key();
		$enable_ajax                   = $options->get_enable_ajax();
		$show_new_attendee_form_first  = $options->get_show_new_attendee_form_first();
		$find_attendee_link_text       = $options->get_find_attendees_link_text();
		$waitlist_friendly_text        = $options->get_waitlist_friendly_text();
		$rsvp_form_url                 = $options->get_rsvp_form_url();
		$form_show_profile_pic          = $options->get_form_show_profile_pic();
		$attendee_list_show_profile_pic = $options->get_attendee_list_show_profile_pic();
		$always_show_additional         = $options->get_always_show_additional();

		if ( is_array( $options->get_admin_roles() ) ) {
			$adminRoles = $options->get_admin_roles();
		}

		if ( is_array( $options->get_attendeelist_custom_qs() ) ) {
			$attendeeListCustomQs = $options->get_attendeelist_custom_qs();
		}

		if ( is_array( $options->get_roles_auto_enroll() ) ) {
			$roles_auto_enroll = $options->get_roles_auto_enroll();
		}

		if ( $options->get_salutations() !== '' ) {
			$salutations = $options->get_salutations();
		}

		if ( is_numeric( $options->get_password_length() ) && ( $options->get_password_length() <= 50 ) ) {
			$password_length = $options->get_password_length();
		}

		// Get the associated attendees and add them to an array.
		$associations = $wpdb->get_results( $wpdb->prepare( 'SELECT rsvpAttendeeID FROM ' . PRO_EVENT_ATTENDEE_TABLE . ' WHERE rsvpEventID = %d', $eventID ) );
		foreach ( $associations as $aId ) {
			$attendeeAccess[] = $aId->rsvpAttendeeID;
		}

		$enable_turnstile              = $options->get_enable_turnstile();
		$turnstile_site_key            = $options->get_turnstile_site_key();
		$turnstile_secret_key          = $options->get_turnstile_secret_key();
	}
}
