Contributing Integration Modules

Overview

WP Fusion includes integration modules with about 100 WordPress plugins. Each module is contained in a single class.

It’s easy to create a new WP Fusion integration for your own plugin, and by doing so enable your plugin to communicate bidirectionally with over 40 CRMs and marketing automation tools.

For a bootstrap to get you started, download this example plugin from GitHub.

Setting up a custom integration module

First download the starter plugin. Then do a find and replace (case sensitive) on four strings:

  • “my-plugin-slug”: This is the slug used to identify your integration.
  • “My_Plugin_Name”: This is the class name for the integration.
  • “My Plugin Name”: This is the human-readable name for the plugin integration
  • “My/PluginDependencyClass”: This is a class name in your plugin. WP Fusion will do a class_exists()on this string when determining whether or not to load the integration module.

Also make sure to rename /includes/class-my-plugin-slug.php to reflect the new slug.

Suggested functionality

The hooks used and functionality in your integration module will depend on the type of plugin, but generally:

Ecommerce integrations

WP Fusion’s ecommerce integrations generally:

  • Sync customers to the CRM at checkout, including their name, email address, billing details, and any custom fields
  • Sync guest checkouts to the CRM and attach the guest’s contact ID to the order meta
  • Allow the user to configure tags to be applied per product at checkout

For examples in WP Fusion see classes WPF_EDD, WPF_Simple_Pay.

Membership integrations

WP Fusion’s membership integrations:

  • Detect custom fields that have been created for user registration or profiles, and make them available for sync using the wpf_meta_fields filter (example provided in the sample plugin)
  • Detect a user registration and make sure that any POST’ed custom field values are properly merged into the output from the wpf_user_register filter (example provided in the sample plugin)
  • Detect a profile update and likewise make sure that any POST’ed custom fields are synced to the CRM with the rest of the data

For examples in WP Fusion see classes WPF_User_Meta, WPF_Simple_Membership, WPF_Clean_Login.

Form integrations

WP Fusion’s form integrations:

  • Register a field mapping interface within the form’s settings or form edit screens that allow mapping form fields with CRM fields (see for example the field mapping interfaces in Ninja Forms, Gravity Forms, or Formidable Forms.
  • Include a setting in the field mapping interface for Apply Tags, so the user can specify CRM tags to be applied when the form is submitted
  • Detect when a form is submitted and extract the submitted values from the form, passing them to WPF_Forms_Helper::process_form_data() (see code examples in integrations mentioned above), and then save the new CRM contact ID to the form entry meta

Event integrations

WP Fusion’s event and booking plugin integrations:

  • Detect custom fields that have been created for event registration or RSVP forms, and make them available for sync using the wpf_meta_fields filter (example provided in the sample plugin)
    • Preferably allows syncing “pseudo” event fields such as event date and time, or venue, for example see FooEvents
  • Detect an event registration and make sure that any attendee fields and custom event fields are properly synced to the CRM (including from guest registrations)
  • Add a meta box or setting input to the event or ticket editor that allows tags to be configured to be applied for event registration, and apply those tags during event registration

For examples in WP Fusion see classes WPF_FooEvents, WPF_Events_Manager, WPF_Modern_Events_Calendar.

Contributing to WP Fusion

We welcome and encourage new submissions for custom integration modules.

To do that first make a fork of the integration boostrap plugin. Once your integration is finished, drop us a line with a link to your fork, we’ll review the integration, and (with your permission) include it in future updates of WP Fusion.

Some recommendations

Minimum versions to support:

  • PHP 7.1 and up
  • WordPress 5.0 and up
  • WooCommerce 3.6 and up (if applicable)

Code standards:

For an example of a properly coded and documented integration module, see the integration bootstrap plugin,  or for a real-world example look at WP Fusion’s YITH WooCommerce Multi Vendor integration.

Internationalisation:

All strings should be translatable via gettext. The textdomain for WP Fusion is wp-fusion.

Was this helpful?