GCal synchronization and cron job ?


I have the A+ <-> GCal synchronization set up and it works both way. But when I create Event directly inside Google calendar, they don't appear immediatly inside A+.

The only way it works, is to click on the "Import and Update" button to update everything. This way works correctly.

Is there a way to add a cron job or something like that to make sure both calendar are always up to date ??

Thanks for your help !

  • Sajid

    Hello Dr.Malcom,
    Hope you are doing good today :slight_smile:

    Appointments from site to google calendar are instant. Meaning that when ever an appointment is confirmed on the site, it will automatically be added in your google calendar. This is because Appointments + triggers the add event instantly since it is happening on site.

    But importing from google calendar can not be instant since Appointments + does not know the appointment/event has been created since it is on a third party site.

    So to sync, it regular check by using API and import events if any.

    So, if you want the changes instantly then you have to click the import button from Appointments setting, that is not ideal though.

    Or you can increase the frequency of checking new events on google calendar. This will definitely require lots of resources of your server.

    If you want to go with second option, then I can ping developer of the plugin to get his invaluable feedback on this matter. As soon as I will hear back from developer, I will post a reply here.

    Take care and have a nice day :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

  • Sajid

    Hello Dr.Malcom,
    Hope you are doing good today :slight_smile:

    I still have not heard back from developer yet since it is weekend and developers mostly take off so I am expecting a response tomorrow.

    But as far as I can tell, he must be using built in WordPress Cron by using wp_schedule_event function. This WordPress schedule functionality depends on front-end visits of the site. That is not hundred percent accurate on even high traffic sites.

    But WordPress also allows an easy way to replace WordPress cron with real cron job via cPanel or hooking it with your system.

    Here is the tutorial to replace WP Cron with real cron job via cPanel:

    Or hooking it with your system:

    Also, please note that you still need to change the frequency to run the script to two minutes. You can do this easily by using the WP Crontrol plugin. This lets you easily manage and monitor what's happening in WordPress cron world.

    Once you will have it installed on your site, go to WordPress Dashboard -> Tools -> Cron Events. Find appointments_gcal_sync in the list under Action Name column and click on edit link (see screenshot).

    Now change the frequency to two minutes (that is the minimum frequency that can be selected at the moment).

    Hope that helps! Feel free to post a reply if you need further assistance :slight_smile:

    Best Regards,
    Sajid - WPMU DEV Support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.