Sorry – Another CRON / Google sync to EA Query

Support forumCategory: BugsSorry – Another CRON / Google sync to EA Query
jamie_peabody asked 4 years ago
So I've just signed up as I've promised my client they can block out times using a Google calendar (2 way sync)....  I can confirm appointments are sending to Google Calendar I can confirm cancellations in Google Calendar are removing appointments from EA However, I am unable to successfully create an event in Google which successfully transfer back to EA. CONNECT (BETA) Settings print screen can be seen by clicking here. You'll notice that WP state the following at the top of the page: " Your Cron background tasks are not running properly! Cron was never executed so far! Please follow official WordPress guide on Hooking WP-Cron Into the System Task Scheduler." Sadly, the linked url is dead: https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/ Unfortunately, my FastHosts reseller hosting account uses shared hosting and does not provide a cPanel to search for a CRON app / setting device... So I am currently manually updating the time slots myself in the database. Can someone provide a guideline for actions to carry out using database/FTP access.. As I do not have the previously mentioned CRON app from here: https://easy-appointments.net/documentation/connect-system-scheduler-cron/ Cheers Jamie
6 Answers
Nikola Loncar Staff answered 4 years ago
Hi Jamie,  there are services that can provide cron like calls to your site. If you don't have cron then sync can be unstable. I would suggest that you try https://cron-job.org/en/  Best regards, Nikola
jamie_peabody replied 4 years ago

Hi Nikola,

My apologies – I already have wp-config.php and wp-cron.php files. However, I do not have a cPanel to access.

My question is how can I access/add new Cron events without cPanel access (Can I access somewhere in myPHP or FTP files)?

For now, I have added WP Control plugin by John Blackbourn & crontributors…. This now gives me visibility of existing cron events like this:

Hook Name Arguments Actions Next Run Recurrence
easyapp_hourly_event None EasyAppointment->delete_reservations() 2019-11-29 21:43:39 (now) Once Hourly
eac_google_sync None EAC_Google_Logic->google_sync() 2019-12-14 20:32:56 (now) Every 5 minutes

It’s the eac_google_sync which is supposed to work but doesn’t work properly. When I click run manually, it fires successfully, but still doesn’t pull events successfully back from the Google calendar into the calendar shown on my website booking form.

My next step is to speak with my host to see if they are restricting anything on their side

jamie_peabody replied 4 years ago

Observation…
When editing the event, it states:
Timezone: Europe/London (UTC+0)

The stated time doesn’t seem to match the actual time and I am wondering whether this could cause a discrepancy….

I’ve also found the WP dox here:

SUMMARY:
https://developer.wordpress.org/plugins/cron/

There are sub-sections for scheduling and hooking too, which I’ll ready through.

jamie_peabody replied 4 years ago

Let’s try that again…

[2019-12-14 22:16:25.946747] [info] Sync started
[2019-12-14 22:16:25.946892] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:16:25.947084] [info] Syncing events for Calendar: primary
[2019-12-14 22:16:25.947129] [info] Sync event within next 0
[2019-12-14 22:16:26.388019] [info] Fetched from Google Calendar 15 events
[2019-12-14 22:16:26.423563] [info] Synced events : 0
[2019-12-14 22:16:26.423636] [info] Total sync events : 0
[2019-12-14 22:16:26.432293] [info] Found 4 events in EA but on on GCal
[2019-12-14 22:16:27.895209] [info] Sync Done

jamie_peabody replied 4 years ago

PROGRES…

It appears to be reading events in the calendar now, but not writing them to the database to block out appointment booking slots:

[2019-12-14 22:16:25.946747] [info] Sync started
[2019-12-14 22:16:25.946892] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:16:25.947084] [info] Syncing events for Calendar: primary
[2019-12-14 22:16:25.947129] [info] Sync event within next 0
[2019-12-14 22:16:26.388019] [info] Fetched from Google Calendar 15 events
[2019-12-14 22:16:26.423563] [info] Synced events : 0
[2019-12-14 22:16:26.423636] [info] Total sync events : 0
[2019-12-14 22:16:26.432293] [info] Found 4 events in EA but on on GCal
[2019-12-14 22:16:27.895209] [info] Sync Done
[2019-12-14 22:21:19.841214] [info] Sync started
[2019-12-14 22:21:19.841351] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:21:19.841559] [info] Syncing events for Calendar: primary
[2019-12-14 22:21:19.841608] [info] Sync event within next 0
[2019-12-14 22:21:20.323618] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:21:20.371920] [info] Synced events : 0
[2019-12-14 22:21:20.371994] [info] Total sync events : 0
[2019-12-14 22:21:20.388605] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:21:20.388679] [info] Sync Done

jamie_peabody replied 4 years ago

Events are still not coming back from Google to EA:

[2019-12-14 22:16:25.946747] [info] Sync started
[2019-12-14 22:16:25.946892] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:16:25.947084] [info] Syncing events for Calendar: primary
[2019-12-14 22:16:25.947129] [info] Sync event within next 0
[2019-12-14 22:16:26.388019] [info] Fetched from Google Calendar 15 events
[2019-12-14 22:16:26.423563] [info] Synced events : 0
[2019-12-14 22:16:26.423636] [info] Total sync events : 0
[2019-12-14 22:16:26.432293] [info] Found 4 events in EA but on on GCal
[2019-12-14 22:16:27.895209] [info] Sync Done
[2019-12-14 22:21:19.841214] [info] Sync started
[2019-12-14 22:21:19.841351] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:21:19.841559] [info] Syncing events for Calendar: primary
[2019-12-14 22:21:19.841608] [info] Sync event within next 0
[2019-12-14 22:21:20.323618] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:21:20.371920] [info] Synced events : 0
[2019-12-14 22:21:20.371994] [info] Total sync events : 0
[2019-12-14 22:21:20.388605] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:21:20.388679] [info] Sync Done
[2019-12-14 22:26:06.681361] [info] Sync started
[2019-12-14 22:26:06.690470] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:26:06.690784] [info] Syncing events for Calendar: primary
[2019-12-14 22:26:06.690888] [info] Sync event within next 0
[2019-12-14 22:26:07.068228] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:26:07.134001] [info] Synced events : 0
[2019-12-14 22:26:07.134087] [info] Total sync events : 0
[2019-12-14 22:26:07.151213] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:26:07.151298] [info] Sync Done
[2019-12-14 22:31:39.425456] [info] Sync started
[2019-12-14 22:31:39.425580] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:31:39.425754] [info] Syncing events for Calendar: primary
[2019-12-14 22:31:39.425805] [info] Sync event within next 0
[2019-12-14 22:31:39.782552] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:31:39.883579] [info] Synced events : 0
[2019-12-14 22:31:39.883660] [info] Total sync events : 0
[2019-12-14 22:31:39.897018] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:31:39.897109] [info] Sync Done

—-

Next step – I’ve seen a comment here about adding in a specific row in “advanced”. Previously, I’ve had nothing set as I thought this was a catch-all. but comments here indicate different:

https://easy-appointments.net/support/problems-with-2-way-sync-w-google-calendar/

jamie_peabody replied 4 years ago

Sadly, this didn’t work so I’ve deleted the specified calendar again under “advanced”. I’ll continue to check a few items, but any suggestions would be a huge help

[2019-12-14 22:16:25.946747] [info] Sync started
[2019-12-14 22:16:25.946892] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:16:25.947084] [info] Syncing events for Calendar: primary
[2019-12-14 22:16:25.947129] [info] Sync event within next 0
[2019-12-14 22:16:26.388019] [info] Fetched from Google Calendar 15 events
[2019-12-14 22:16:26.423563] [info] Synced events : 0
[2019-12-14 22:16:26.423636] [info] Total sync events : 0
[2019-12-14 22:16:26.432293] [info] Found 4 events in EA but on on GCal
[2019-12-14 22:16:27.895209] [info] Sync Done
[2019-12-14 22:21:19.841214] [info] Sync started
[2019-12-14 22:21:19.841351] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:21:19.841559] [info] Syncing events for Calendar: primary
[2019-12-14 22:21:19.841608] [info] Sync event within next 0
[2019-12-14 22:21:20.323618] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:21:20.371920] [info] Synced events : 0
[2019-12-14 22:21:20.371994] [info] Total sync events : 0
[2019-12-14 22:21:20.388605] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:21:20.388679] [info] Sync Done
[2019-12-14 22:26:06.681361] [info] Sync started
[2019-12-14 22:26:06.690470] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:26:06.690784] [info] Syncing events for Calendar: primary
[2019-12-14 22:26:06.690888] [info] Sync event within next 0
[2019-12-14 22:26:07.068228] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:26:07.134001] [info] Synced events : 0
[2019-12-14 22:26:07.134087] [info] Total sync events : 0
[2019-12-14 22:26:07.151213] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:26:07.151298] [info] Sync Done
[2019-12-14 22:31:39.425456] [info] Sync started
[2019-12-14 22:31:39.425580] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:31:39.425754] [info] Syncing events for Calendar: primary
[2019-12-14 22:31:39.425805] [info] Sync event within next 0
[2019-12-14 22:31:39.782552] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:31:39.883579] [info] Synced events : 0
[2019-12-14 22:31:39.883660] [info] Total sync events : 0
[2019-12-14 22:31:39.897018] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:31:39.897109] [info] Sync Done
[2019-12-14 22:36:01.498948] [info] Sync started
[2019-12-14 22:36:01.499099] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:36:01.499294] [info] Syncing events for Calendar: primary
[2019-12-14 22:36:01.499345] [info] Sync event within next 0
[2019-12-14 22:36:01.988163] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:36:02.027796] [info] Synced events : 0
[2019-12-14 22:36:02.027976] [info] Total sync events : 0
[2019-12-14 22:36:02.036973] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:36:02.037076] [info] Sync Done
[2019-12-14 22:41:14.565825] [info] Sync started
[2019-12-14 22:41:14.570651] [debug] Calendars for sync
primary: array(
‘location’ => ‘*’,
‘service’ => ‘*’,
‘worker’ => ‘*’,
)
[2019-12-14 22:41:14.570950] [info] Syncing events for Calendar: primary
[2019-12-14 22:41:14.571028] [info] Sync event within next 0
[2019-12-14 22:41:14.793252] [info] Fetched from Google Calendar 19 events
[2019-12-14 22:41:14.818510] [info] Synced events : 0
[2019-12-14 22:41:14.818660] [info] Total sync events : 0
[2019-12-14 22:41:14.821465] [info] There are no new appointments needed to be send to Google Calendar
[2019-12-14 22:41:14.821733] [info] Sync Done

jamie_peabody replied 4 years ago

FYI: The page is here: https://www.melaniejonesspiritualmedium.com/services/#booking

I’ve booked the 28th December as a complete day but it isn’t blocking the EA calendar online.

jamie_peabody answered 4 years ago
Following on from this, I\'ve created a wp-cron.php job within cron-job.org, and the status is \"successful\". However, it is still not completing the 2-way sync.  Plug-in log states: [2019-12-14 22:16:25.946747] [info] Sync started[2019-12-14 22:16:25.946892] [debug] Calendars for syncprimary: array(\'location\' => \'*\',\'service\' => \'*\',\'worker\' => \'*\',)[2019-12-14 22:16:25.947084] [info] Syncing events for Calendar: primary[2019-12-14 22:16:25.947129] [info] Sync event within next 0[2019-12-14 22:16:26.388019] [info] Fetched from Google Calendar 15 events[2019-12-14 22:16:26.423563] [info] Synced events : 0[2019-12-14 22:16:26.423636] [info] Total sync events : 0[2019-12-14 22:16:26.432293] [info] Found 4 events in EA but on on GCal[2019-12-14 22:16:27.895209] [info] Sync Done
jamie_peabody answered 4 years ago
So to confirm, EA appears on the website. I can make a booking which blocks a lot on my google calendar and EA calendar successfully. From here, I can successfully cancel the event within the Google calendar. However, it no longer cancels the appointment in my database - it used to before I halted cron in wp-config and switched to: https://cron-job.org/ I am still unable to get either installation to successfully send event entries from Google Calendar to my database. Can you advise further?  Kind regards Jamie
Nikola Loncar Staff answered 4 years ago
Hi Jamie, looks like missing mapping between EA and Google Calendar. Inside Extension there is Advance sync options mapping. There you can connect particular service location and worker with Google Calendar. I guess that is the issue here because this part:
Fetched from Google Calendar 19 events Synced events : 0 Total sync events : 0
It get 19 events but don't do anything with those. Best regards, Nikola
jamie_peabody answered 4 years ago
Phew!.. Finally got there!  So in a nutshell, here's a summary for future readers...  I use shared hosting, so I do not have access to a cPanel with tools which include cron jobs. This means I need to find a manual way to edit automatic cron files...  At first impression, the WordPress version seemed to accommodate for this. When I read up on it, WordPress have a wp-cron.php which handles cron events for instances like mine. However, this did not work successfully for the 2-way sync. This is what I achieved:
  • Successful install
  • Successful website booking
  • successful Google calendar post
  • successful Google calendar cancellation
  • successful website cancellation
HOWEVER!.. I was unable to get events added into Google calendar to sync back with the website calendar and block out time. Early indications were that there was a problem with the CRON event task manager, so the first thing I did was to cancel the WordPress automatic running of the wp-cron.php file within the WordPress environment. I did this by:
  • Adding define( 'DISABLE_WP_CRON', true ); directly under the command define( 'DB_COLLATE', '' ); to the wp-config.php file
  • Visiting cron-job.org, creating an account and setting up an external cron schedule to include:
    • Title - free text to describe your job
    • Address - full URL of your wp-cron.php file, usually something like:
      https://www.INSERT-YOUR-DOMAIN-HERE.com/wp-cron.php
    • Authentication - I've left this blank with successful results
    • Schedule - every 5 minutes for me, but I may change to every 15 minutes later
    • Notifications - when the cronjob will be disabled
    • Request Method - GET
    • Common - Enable cronjob & Save responses
... It was at this point, I found that any Google-to-EA sync failed. It never occurred to me to set dedicated calendars within the advanced setting section due to the following comment: "* If you want to sync only with Primary Google calendar leave Advanced Calendars sync table empty. " It turns out that this was the final step required for successful installation. A comprehensive calendar map need to be added in order to successfully work the 2-way synchronisation. Go to: EASY APPOINTMENTS > CONNECT (BETA) > ADVANCED CALENDARS SYNC Ensure you map every worker, location and service. If you're using multiple calendars then I imagine these need specific maps too. With hindsight, I'm willing to bet the my main problem was the comprehensive mapping rather than the external cron schedule. However, I now have scheduling running every 5 minutes rather than when a visitor attends the website to trigger the cron file. Anyone looking for a quick fix may find that simply adding a comprehensive calendar map may solve the initial problem. For reference, my host is Fasthosts... And thank-you Nikolas for your prompt responses.
Nikola Loncar Staff replied 4 years ago

Thanks for that update 🙂

Nikola Loncar Staff answered 4 years ago
I will mark this topic as resolved. :) Best regards, Nikola