=== DWBooster Integration for Calculated Fields Form with Google Calendar ===
Contributors: codepeople2
Tags:calculated fields form,google,calendar,events,timeslots
Donate link: https://cff-bundles.dwbooster.com/product/google-calendar
Requires at least: 6.0
Requires PHP: 7.0
Tested up to: 6.8
Stable tag: 1.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Easily sync your "Calculated Fields Form" Date/Timeslots controls with Google Calendar to manage schedules and prevent overlapping events.

== Description ==

The "DWBooster Integration for Calculated Fields Form with Google Calendar" plugin enables seamless synchronization between your "Calculated Fields Form" Date/Timeslots controls and Google Calendar, helping you avoid event conflicts. It automatically disables any timeslots in your form that overlap with busy periods on your connected calendar.

Additionally, the commercial version of the plugin allows you to create Google Calendar events directly using the information submitted through your form.

== External services ==

This plugin integrates with the Google Calendar API to retrieve the date and duration of existing events. This functionality is essential for deactivating unselectable time slots in the Date/Timeslots control within the form, thereby preventing any potential time conflicts.

This Google Calendar API is provided by "Google": [terms of use](https://developers.google.com/terms/), [privacy policy](https://developers.google.com/terms/api-services-user-data-policy).

== Installation ==

The installation process of the "DWBooster Integration for Calculated Fields Form with Google Calendar" plugin is similar to that of any other WordPress plugin. Note this plugin requires you must have installed the [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/) plugin installed.

For the free plugin distribution:

* Go to the Plugins section in your WordPress dashboard.
* Click the "Add New" button at the top of the page.
* Enter "DWBooster Integration for Calculated Fields Form with Google Calendar" in the search box.
* Finally, install and activate the plugin.

For the commercial plugin distribution:

* Download the ZIP file containing the plugin's code to your computer (using the download link provided after purchase), and then follow these steps:
* Go to the Plugins section in your WordPress dashboard.
* Click the "Add New" button at the top of the page.
* Click the "Upload Plugin" button, then select the previously downloaded ZIP file.
* Finally, install and activate the plugin.

Once activated, the plugin adds a new menu option:
Calculated Fields Form > Google Calendar

This page allows you to link your forms to Google Calendar for easy event management and conflict prevention.

== 🗓️ Google Calendar Integration ==

To connect your website with **Google Calendar**, you need a **Google Client ID** and **Google Client Secret**. Follow the steps below:

1. Go to the **[Google Cloud Console](https://console.developers.google.com)**.
2. **Create a new project** - or select an existing one.
3. **Name your project.** Google Cloud will automatically generate a unique Project ID.
4. Your project name will appear at the top of the left sidebar.
5. From the left menu, go to **APIs & Services → Library**.
6. Search for **Google Calendar API** and **enable** it.

### 🔑 Create OAuth Credentials

7. Navigate to **APIs & Services → Credentials**.
8. Click **"Create Credentials" → "OAuth Client ID."**
9. If prompted, configure your **OAuth consent screen** first (see the next section).
10. Choose **Web Application** as the Application Type.
11. Enter a **Name** for the credentials.
12. Under **Authorized JavaScript origins**, add your website domain (e.g., `https://yourdomain.com`).
13. Under **Authorized redirect URIs**, paste the **Redirect URL** provided in the plugin interface.
14. Click **Create.** You'll now see your **Client ID** and **Client Secret**.

### 🧾 Configure the OAuth Consent Screen

15. Go to **APIs & Services → OAuth consent screen**.
16. Under **User Type**, select **External** (recommended).
17. Fill in the required information such as **App Name**, **User Support Email**, and **Developer Contact Info**.
18. In the **Test Users** section, add the email address of the **Google Account** you'll use to connect the calendar.

### ⚙️ Connect Your Website

19. In your plugin settings page, enter the **Client ID** and **Client Secret**.
20. Click **"Save Settings & Generate Tokens."**
21. You'll be redirected to your Google Account to **grant permission** for your website to access your calendars.

Once you've completed these steps, your website will be successfully linked with **Google Calendar**.

== Integration in Forms ==

The plugin adds a new section in the form settings titled: **"DWBooster Integration for Calculated Fields Form with Google Calendar"**

### 🔧 How to integrate the plugin with a form

* Press the "Build" button corresponding to your form in the "Forms" list, which is accessible via the "Calculated Fields Form" menu option.
* Scroll down to the "DWBooster Integration for Calculated Fields Form with Google Calendar" section.
* Tick the **"Enable Google Calendar integration"** checkbox.
* By default, the plugin selects your **"primary"** calendar. To use a different one, press the **"Select another calendar"** button. This will load a list of calendars associated with your account, allowing you to select the calendar you want to associate with the form.
* Insert a **Date/Timeslot** control in the form, and select it from the **"Timeslot field"** list. The plugin will link this control to Google Calendar for scheduling.

### 📅 Creating Google Calendar events from form submissions (Commercial Feature)

* Tick the **"Create Google Calendar event on form submission."** checkbox.
* Select the email controls from the **"Attendee email fields"** attribute. The plugin will add the collected emails as attendees of the calendar event.
* Enter the event summary in the **"Calendar summary text"** text area.
* Enter the event description in the **"Calendar description text"** text area.

> **Note:** Both the **summary** and **description** attributes support the same fields and informative tags that are available in the notification emails.

== Changelog ==

= 1.0.0 =

* First version released.