=== Mindbaz Contact Sync ===
Contributors: mindbaz
Tags: mindbaz, emailing, newsletter, subscribers, contact form
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sync WordPress contact form submissions to your Mindbaz email marketing database via the API.

== Description ==

**Mindbaz Contact Sync** automatically sends contacts collected from your WordPress forms to your Mindbaz email database.

Whether you use a standalone subscription form, Contact Form 7, or Gravity Forms, this plugin connects your forms to Mindbaz in minutes — no coding required.

**Features:**

* Secure settings page to enter your API key and Site ID
* Creates contacts (email, first name, last name) via the Mindbaz API
* Handles partner opt-in (field id=8)
* Automatically subscribes contacts to the newsletter with a collect origin
* Activity log to monitor synchronizations and errors
* Built-in connection test button
* 3 shortcodes to integrate with any form — no coding required
* Multilingual support (French, English, Spanish) — compatible with Loco Translate

**Shortcodes:**

* `[mindbaz_form]` — Displays a standalone subscription form (email, first name, last name, partner opt-in)
* `[mindbaz_cf7 form_id="123"]` — Connects an existing Contact Form 7 form to Mindbaz
* `[mindbaz_gravity form_id="1" email_field="3"]` — Connects an existing Gravity Forms form to Mindbaz

**Mindbaz fields used:**

* id=1: Email (required)
* id=14: First name
* id=15: Last name
* id=8: Partner opt-in

== Installation ==

1. Upload the `mindbaz-contact-sync` folder to the `/wp-content/plugins/` directory
2. Activate the plugin from the **Plugins** menu in WordPress
3. Go to **Settings > Mindbaz** and enter your API key and Site ID
4. Use the **Test connection** button to validate your credentials
5. Place a shortcode on any page or post to start collecting subscribers

The plugin ships with French, English and Spanish translations. WordPress automatically loads the correct language file based on the site language configured in **Settings > General > Site Language**.

To add or edit translations, open the `.po` files located in the `languages/` folder with [Poedit](https://poedit.net/) or use the [Loco Translate](https://wordpress.org/plugins/loco-translate/) plugin directly from your WordPress admin.

== Usage ==

= Standalone form =

Place this shortcode on any page:

`[mindbaz_form]`

Available options:

`[mindbaz_form button_label="Subscribe" success_msg="Thank you!" show_optin="true" optin_label="I agree to receive partner offers"]`

= Contact Form 7 integration =

Replace your existing CF7 shortcode with:

`[mindbaz_cf7 form_id="123"]`

If your field names differ from CF7 defaults:

`[mindbaz_cf7 form_id="123" email_field="your-email" firstname_field="your-name" lastname_field="your-lastname" optin_field="optin-partners"]`

= Gravity Forms integration =

Replace your existing Gravity Forms shortcode with:

`[mindbaz_gravity form_id="1" email_field="3" firstname_field="1.3" lastname_field="1.6" optin_field="5"]`

Field IDs are visible by hovering over fields in the Gravity Forms editor.

= PHP integration (advanced) =

You can also call the function directly from your theme:

`mindbaz_add_subscriber([
    'email'          => 'john@example.com',
    'firstname'      => 'John',
    'lastname'       => 'Doe',
    'optin_partners' => true,
]);`

== Changelog ==

= 1.2.2 =
* Renamed plugin to "Mindbaz Contact Sync" (new slug: mindbaz-contact-sync)
* Added == External services == section documenting Mindbaz API usage, terms and privacy policy
* Fixed potential XSS in shortcode callbacks (wp_kses_post applied to do_shortcode output)

= 1.2.1 =
* Renamed plugin to "Mindbaz Contact Sync"
* Added Author URI and License URI to plugin header

= 1.2.0 =
* Added multilingual support (i18n) — French, English and Spanish translations included
* All interface strings are now translatable via standard WordPress .po/.mo files
* Compatible with Loco Translate for in-admin translation management

= 1.1.0 =
* Added [mindbaz_form] shortcode for standalone subscription form
* Added [mindbaz_cf7] shortcode for Contact Form 7 integration
* Added [mindbaz_gravity] shortcode for Gravity Forms integration

= 1.0.0 =
* Initial release

== External services ==

This plugin connects to the Mindbaz API to create and update contacts in your Mindbaz email marketing database.

**What data is sent and when:**
When a visitor submits a contact form (standalone form, Contact Form 7, or Gravity Forms), the following data is transmitted to the Mindbaz API:
- Email address (required)
- First name (optional)
- Last name (optional)
- Partner opt-in consent (optional)

Data is sent only upon form submission and only if the plugin is properly configured with a valid API key and Site ID.

**Service provider:** Mindbaz SAS
- Website: https://www.mindbaz.com/
- API endpoint: https://api.mindbaz.com/
- Terms of service: https://www.mindbaz.com/cgv/
- Privacy policy: https://www.mindbaz.com/wp-content/uploads/2023/11/MINDBAZ_Privacy_policy.pdf

No data is transmitted to any other third-party service.

== Frequently Asked Questions ==

= Where do I find my Mindbaz API key? =

Log in to your Mindbaz account, then go to **Integrations > API Keys**. Copy the key and paste it into the plugin settings at **Settings > Mindbaz**.

= Where do I find my Site ID (idsite)? =

Your Site ID is visible in your Mindbaz account dashboard. It is the numeric identifier associated with your contact database.

= Does this plugin work with Contact Form 7? =

Yes. Use the `[mindbaz_cf7 form_id="123"]` shortcode, replacing `123` with the ID of your Contact Form 7 form.

= Does this plugin work with Gravity Forms? =

Yes. Use the `[mindbaz_gravity form_id="1" email_field="3"]` shortcode. Field IDs are visible when you hover over each field in the Gravity Forms editor.

= How do I check that contacts are being sent correctly? =

The plugin includes an activity log accessible from the settings page. It records each synchronization attempt along with any errors returned by the Mindbaz API.

= Which languages are supported? =

The plugin includes translations for French, English, and Spanish. Additional languages can be added using Poedit or the Loco Translate plugin.

== Screenshots ==

1. Plugin settings page — enter your API key and Site ID.
2. Standalone subscription form displayed on the front end.
3. Activity log showing synchronization results.

== Upgrade Notice ==

= 1.2.2 =
* Renamed plugin to "Mindbaz Contact Sync" (new slug: mindbaz-contact-sync)
* Added == External services == section documenting Mindbaz API usage, terms and privacy policy
* Fixed potential XSS in shortcode callbacks (wp_kses_post applied to do_shortcode output)

= 1.2.1 =
Renamed plugin to "Mindbaz Contact Sync". No settings or data are affected — simply update and reactivate.
