Performance

Performance

#The basics
WP Fusion was designed with performance in mind, and is used on sites with hundreds of thousands of users, and stores processing thousands of transactions a day.
Unlike some other membership plugins with CRM integrations, WP Fusion will only connect to your CRM as a direct result of user action. For example:

Updating a profile
Making a purchase
Completing a course

WP Fusion does not connect to your CRM to authenticate user logins, and it does not run any background synchronization processes.
Another benefit of this is that even if your CRM』s API is offline or unreachable, your users will still be able to log in and access their content.
#General tips
On a fresh install WP Fusion will have no noticeable impact on your site』s speed at all. However there are some steps you can take to maintain optimal performance on your WP Fusion powered site.
#Use webhooks
WP Fusion includes the option to load your user』s latest tags and meta data from your CRM on login.

While this is an easy way to make sure their data is always up to date, this will slow down the login process while the various API calls are made.
Instead, set up webhooks from your CRM to WP Fusion. You can trigger a webhook only when something has modified and needs to be updated in WordPress. Since webhooks run in the background, your users』 updated tags and meta data will already be available when they log in.
#Keep 「Push All」 turned off
WP Fusion has a setting that will sync data to your CRM whenever any field in your database is modified.

This setting is intended for people using plugins or custom code that isn』t supported by WP Fusion, but shouldn』t be necessary on normal sites. Leaving this setting on may result in unnecessary API calls being sent.
#Be careful with 「Linked」 tags
WP Fusion includes a powerful feature called 「Link with tag」, which allows you to automate enrollment into courses, groups, and membership levels when a tag is applied.

As a general rule, only specify a linked tag if you』re trying to trigger an automated enrollment via an outside trigger. For example a product purchase in an outside shopping cart, or using a drip sequence in your CRM.
If you are using linked tags, avoid overlapping their functionality. For example if you have a linked tag that enrolls someone into a membership, and that membership includes bundled courses, it』s not necessary to set a linked tag on each of the courses as well. This can create a chaining situation which can slow down your site.
#The technical stuff
WP Fusion includes a few technologies to keep your site running fast.
#Asynchronous webhooks
By default incoming webhooks are processed in real time. When the webhook is received WP Fusion connects to your CRM and loads the relevant data. This generally works well, but if many webhooks are received at once (i.e. several hundred), this could cause your server to get overloaded and some webhooks may be ignored.
You can get around this by appending &async=true to the end of your webhook URL. This will cause WP Fusion to put your incoming webhooks into a queue and work through them as server resources allow, usually within a minute or two. While this does slow down the amount of time to process a single webhook, it allows WP Fusion to receive and act on more incoming webhooks simultaneously.
#The API queue
The API queue is enabled by default, though it can be turned off for troubleshooting purposes. The setting is under the Advanced tab.

With the API queue on, WP Fusion puts all API calls into a buffer and executes them during PHP』s shutdown function.
This means that any delay introduced by API calls will happen in the footer of the page, after the page has already loaded for the site visitor.
The queue also combines redundant calls into a single API call. For example
wp_fusion()->user->push_user_meta( $user_id, array( 'first_name' => 'John' ) );

wp_fusion()->user->push_user_meta( $user_id, array( 'user_email' => '[email protected]' ) );

With the API queue off these two function calls would trigger two API calls. With the queue on it will just send a single API call.
The queue combines calls that:

Apply tags
Remove tags
Update contacts

#Asynchronous checkout
Depending on the addons you have installed, a checkout can take a lot of time to process— adding a contact, applying tags, adding products, adding an invoice, and removing abandoned cart tags.
To speed this up, WP Fusion has an option for Asynchronous Checkout with WooCommerce and Easy Digital Downloads. This setting is enabled by default and can be found on the Integrations tab.
With async checkout enabled, WP Fusion will send a non-blocking POST request to a background worker on your server. This lets WP Fusion process all the API calls in the background without delaying the checkout.
#The background process worker
WP Fusion includes a background worker which can export users, membership statuses, order details, and more to your CRM.

This background worker is based on the WP Background Processing library. Items to be processed are added to a queue and are worked through sequentially, taking into account the server』s available memory and max execution time.
Using the background worker we have processed up to 300,000 WooCommerce orders in a single go.
The background process can run for up to 24 hours. This can be extended if needed by using the 'nonce_life' filter.
#Admin performance
If you have a lot of tags and/or custom fields in your CRM (i.e. 1,000+ options), the WP Fusion interfaces can be slow to load in the admin.
To avoid this, WP Fusion has two built in thresholds:

If there are more than 300 custom fields available for sync on the Contact Fields list, the field select dropdown will revert to a standard HTML dropdown instead of the searchable select2 dropdown.
If there are more than 1,000 total tags in your CRM, the Select Tag(s) dropdown will lazy load the tags instead of trying to display all the options at once. After you』ve entered the first three characters of your tag name, WP Fusion will search the database and return the results.

There are three filters you can use to further customize the display of the tags and CRM fields dropdowns:
add_filter( 'wpf_disable_tag_multiselect', '__return_true' );
Completely disables the Select Tag(s) select box. It will not be output on the page at all.
add_filter( 'wpf_disable_tag_select4', '__return_true' );
Disables the enhanced interface on the Select Tag(s) select box. It will be displayed as a normal select input.
add_filter( 'wpf_disable_crm_field_select4', '__return_true' );
Disables the enhanced interface on the Select A CRM Field select box. It will be displayed as a normal select input.

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

wpf_post_type_rules

wpf_post_type_rules

#Overview
This filter lets you apply WP Fusion』s access controls to an entire post type.
To use the code examples below, add them to your active theme』s functions.php file.
#Parameters

$rules: An array of post types and their access control rules

#Rule properties
The array properties for the access rules are the same as those saved on an individual post. They are:

lock_content: (bool) The user must be logged in to access the content
allow_tags: (array) The user must have at least one of the specified tags to access the content. Tag IDs must be used if the CRM uses tag IDs. If you』re not sure, use wpf_get_tag_id( $name ) to get the ID.
allow_tags_all: (array) The user must have all of the tags to access the content
allow_tags_not: (array) The user must have none of the tags to access the content
redirect: (int) A post ID to redirect the user to if access is denied. Leave blank to display the Restricted Content Message
redirect_url: (string) Optionally specify a remote URL to redirect the user to if access is denied. Will take priority over redirect

#Examples
The example below will protect a custom post type with slug my_type and redirect the user if they don』t have the required tags.
function wpf_post_type_rules( $rules ) {

$rules['my_type'] = array(
'lock_content' => true,
'allow_tags' => array( 'Tag One' ), // Array of required tags (any). Must use tag IDs if the CRM uses tag IDs
'allow_tags_all' => array( 'Tag Two', 'Tag Three' ), // Array of required tags (all)
'allow_tags_not' => array( 'Payment Failed' ), // Array of required tags (not)
'redirect' => 123, // Post ID to redirect to
'redirect_url' => 'https://example.com/', // OR enter a URL (overrides post ID redirect)
);

return $rules;

}

add_filter( 'wpf_post_type_rules', 'wpf_post_type_rules' );

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

wpf_format_field_value

wpf_format_field_value

#Overview
Most of WP Fusion』s supported CRMs support different custom field types in addition to text fields, for example dates, picklists, dropdowns, and radios.
The wpf_format_field_value filter is run on each field value before it』s synced to your CRM, to convert WordPress formatted data into the appropriate format in your CRM.
#Parameters

$value: (mixed) The field value that will be synced to the CRM
$field_type: (string) The field type as shown on the Contact Fields list in the WP Fusion settings
$field: (string) The field』s API name in your CRM

#How it works in WP Fusion
This happens in two places, at two priorities. In the class WPF_CRM_Base there is a format_field_value() function attached to priority 5 that does some standardized formatting for all CRMs:

Dates are converted into Unix timestamps
Array values (like multiselects) are combined into a comma-separated string
Checkbox values are converted to 1 if they are checked or null if they are un-checked.

Then in each CRM integration module there is a format_field_value() function attached to priority 10, which does additional formatting based on that CRM』s API. For example:

With ActiveCampaign, multiselect values are separated with pipes || to properly update multiselect fields
With Infusionsoft dates are converted from their UNIX timestamps into ISO 8601 dates
With Mautic states and countries are converted into Mautic-compatible state and country abbreviation codes

#Examples
You may sometimes need to change the way field values are formatted before being synced to your CRM in addition to WP Fusion』s default formatting. To use the code examples below, add them to your active theme』s functions.php file.
#Convert Yes / No strings to checkbox values
This example converts 「Yes」 and 「No」 values submitted on a form to boolean values, for updating checkbox-type fields in your CRM.
function custom_format_checkbox( $value, $field_type, $field ) {

if ( 'Yes' == $value ) {
$value = true;
} elseif ( 'No' == $value ) {
$value = null;
}

return $value;

}

add_filter( 'wpf_format_field_value', 'custom_format_checkbox', 20, 3 );
#Convert checkbox values to strings
WP Fusion syncs checkbox values to your CRM as boolean true and null, which is the most compatible with updating checkbox and radio type custom fields in your CRM.
However, you may want to see the actual text 「True」 and 「False」 in your CRM. This example converts those boolean values back to strings.
function custom_format_checkbox( $value, $field_type, $field ) {

if ( 'checkbox' == $field_type && true == $value ) {
$value = 'True';
} elseif ( 'checkbox' == $field_type && null == $value ) {
$value = 'False';
}

return $value;

}

add_filter( 'wpf_format_field_value', 'custom_format_checkbox', 20, 3 );
#Prepend a 1 to phone numbers
If your CRM has a phone-type field that enforces a certain length, you may need to prepend a country code to the number for it to sync properly.
function custom_format_phone( $value, $field_type, $field ) {

if ( 'phone' == $field && strlen( (string) $value ) <= 10 ) {

$value = '1' . $value;

}

return $value;

}

add_filter( 'wpf_format_field_value', 'custom_format_phone', 20, 3 );
#Custom formatting for dates
You may want to store a date in a text field in a different format from the default for your CRM.
function custom_format_date( $value, $field_type, $field ) {

if ( $field_type == 'datepicker' || $field_type == 'date' ) {

$value = date( 'Y-m-d', strtotime( $value ) );

}

return $value;

}

add_filter( 'wpf_format_field_value', 'custom_format_date', 20, 3 );
#Force an empty value
By default WP Fusion won』t sync an empty text value to your CRM, to avoid overwriting existing data. You can override this by setting the field』s value to null.
In this example we』ll set WP Fusion to always send a null value any time data isn』t specified for the CRM field with key mycrmfieldkey:
function custom_format_empty_fields( $value, $field_type, $field ) {

if ( 'mycrmfieldkey' == $field && empty( $value ) ) {

$value = null;

}

return $value;

}

add_filter( 'wpf_format_field_value', 'custom_format_empty_fields', 4, 3 );
Or, to target based on field type:
function custom_format_empty_dates( $value, $field_type, $field ) {

if ( 'date' === $field_type && empty( $value ) ) {

$value = null;

}

return $value;

}

add_filter( 'wpf_format_field_value', 'custom_format_empty_dates', 4, 3 );
Note that the priority on the filters is 4, so it runs before WP Fusion has done any other formatting on the field value.

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

What can I do with it?

What can I do with it?

#Video Overview

#Run a membership site
WP Fusion offers an intuitive page locking system that can restrict access to any content on your site based on a user』s tags in your CRM. This lets you use your WordPress site to:

Sell online courses with LearnDash or LifterLMS
Create members-only discussion forums with bbPress
Create archives of downloadable material for members
And almost anything else you can think of

WP Fusion can intelligently redirect users to alternate pages on your site if they don』t have permission to access a given piece of content, or show a custom error message.
 
#Sync ecommerce data
WP Fusion includes deep ecommerce integrations with WooCommerce, Easy Digital Downloads, and LifterLMS. Using our Enhanced Ecommerce addon you can sync a variety of data to supported CRMs, including:

Products purchased
Quantities
Taxes and shipping
Discounts
Invoices

This data can then be used in reports and to track lifetime value as well as trigger automations.
#Customize the user experience
WP Fusion synchronizes your customers』 CRM contact records with your WordPress users database. This means that all of your CRM contact data is accessible by any WordPress plugin.
We like using the Ultimate Member plugin for creating and managing custom user fields, as well as allowing users to update their profile data from within your WordPress site.
You can also use tags in your CRM to show and hide page content, with support for many of the most popular page builders and popup builders.
Imagine your customers coming back to your website and being greeted with a personalized message. WP Fusion can do that.
#Track and engage leads
WP Fusion has the ability to automatically apply tags to a contact when they visit a certain page on your site. You can even gauge their interest by setting a delay before the tag is applied.
For example, if a customer reads your product description page for more than three seconds, why not automatically send them an email with a special discount if they purchase now? WP Fusion can do that.
Using lead source tracking you can also keep track of UTM variables and referral URLs, and sync these to a your CRM when someone registers or makes a purchase.
#Keep WordPress sites in sync
Because WP Fusion can push user data to your CRM, and be configured to receive data automatically from your CRM, you can use WP Fusion to keep user accounts in sync across multiple sites.
With some simple configuration, you can use your CRM application as a central hub to keep user accounts on an unlimited number of WordPress installs synchronized, including user logins and passwords.
#Perform actions with user data
Because WP Fusion supports synchronizing any user metadata collected on your site, you can use a wide variety of WordPress plugins to collect  user data at registration, profile update, or when a form is submitted.
After the user has been registered, all data is passed through to your CRM, where you can use automations to apply tags, create tasks, set opportunity states, or send emails based on their provided data.

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

wpf_forms_apply_tags

wpf_forms_apply_tags

#Overview
This filter is run when WP Fusion is processing a form submission from one of our supported form plugins.
It is triggered after the contact record has been created / updated in the CRM, but before any tags have been applied. It can be used to modify the tags that will be applied as part of the form submission.
To use the code examples below, add them to your active theme』s functions.php file.
#Alternate filters
For more precise targeting there are two alternate filters with the same arguments:

wpf_{integration slug}_apply_tags : Where {integration_slug} is the name of the form integration, for example wpf_gform_apply_tags
wpf_{integration slug}_apply_tags_{form_id} : Where {form_id} is the ID of the submitted form, for example wpf_ninja_forms_apply_tags_1

#Parameters

$apply_tags (array): This is an array of tags that will be applied to the person who submitted the form
$user_id (int): The user who submitted the form, 0 if a guest
$contact_id (string): The ID of the contact record created / updated by the form submission
$form_id (int): The ID of the submitted form

#Examples
#Apply an additional tag based on a cookie
This example checks to see if the person submitting the form came to the site via an AffiliateWP affiliate link, and is being tracked with the affwp_refcookie. If so, the tag Affiliate Tag is applied.
function merge_affiliate_tags( $apply_tags, $user_id, $contact_id, $form_id ) {

if ( isset( $_COOKIE['affwp_ref'] ) ) {
$apply_tags[] = 'Affiliate Tag';
}

return $apply_tags;

}

add_filter( 'wpf_forms_apply_tags', 'merge_affiliate_tags', 10, 4 );
#Use 「Round Robin」 assignment for leads
This example randomly assigns each lead a tag of either Tag A, Tag B or Tag C. This is similar to the 「Round Robin」 owner assignment in sales CRMs like Infusionsoft, and can be used to randomly assign leads to a sales rep.
function apply_round_robin_tags( $apply_tags ) {

// To properly randomize the tags we'll do it based on the current time

$time = date( 's' );

// $time will be 00 to 59

if ( $time = 20 && $time < 40 ) {
$apply_tags[] = 'Tag B';
} elseif ( $time < 60 ) {
$apply_tags[] = 'Tag C';
}

return $apply_tags;

}

add_filter( 'wpf_forms_apply_tags', 'apply_round_robin_tags' );

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

wpf_crm_object_type

wpf_crm_object_type

#Overview
By default WP Fusion interfaces with Contacts in all of our supported CRM integrations. Some platforms like Salesforce, Ontraport, and Zoho support custom object types in addition to contacts (like Leads).
You can override WP Fusion to interface with a different object type via a filter in your functions.php file.
Changing the object type will also reset the fields available for syncing. After changing the object type, please reload the available fields by going to Settings » WP Fusion » Setup and clicking the blue Resync Available Tags & Fields button.
#Salesforce
For example, to interface with Salesforce』s 「leads」 component, you would use the following:
add_filter( 'wpf_crm_object_type', function( $object_type ) {
return 'Lead';
});
#Zoho
To interface with Zoho』s 「leads」 component, you would use the following:
add_filter( 'wpf_crm_object_type', function( $object_type ) {
return 'Leads';
});
#Ontraport
Ontraport uses numeric IDs for object types. The default type is 0 for contacts. To override that, pass the ID of your custom object into the filter.
add_filter( 'wpf_crm_object_type', function( $object_type ) {
return 8;
});
#Can WP Fusion interface with multiple object types at the same time?
The short answer is no.
That』s because WP Fusion syncs your WordPress users bidirectionally with the selected object type in your CRM.
That』s usually Contacts, but could also be Leads or a custom object type.
If you take a hypothetical scenario where WP Fusion is configured to sync with both Contacts and Leads at the same time:

A new Lead is created in Zoho CRM
A webhook syncs the Lead back to a new WordPress user account
The user updates their profile, which creates a Contact in Zoho
Now you have two duplicate records, one Lead and one Contact, both linked to the same WordPress user

Or

Email address is updated on [email protected]』s lead record
The changed email address is loaded to Jane』s WordPress user account
WP Fusion syncs the changed email address to Jane』s contact record

Obviously it doesn』t do any good to have two separate CRM objects that are kept in sync with eachother, since the records will be identical.
And it will slow down your WordPress site having WP Fusion constantly connecting to your CRM to sync the objects with eachother.
#Conditionally switching object types
An exception to that is switching the object type temporarily, just for certain operations.
For example maybe you have WP Fusion syncing your users bidirectionally with Contacts in your CRM, but you want all Gravity Form submissions to create a new Lead (with a one-way sync).
function my_gform_after_submission( $entry, $form ) {

if ( ! function_exists( 'wp_fusion' ) ) {
return false; // Make sure WP Fusion is running
}

// Gets the first name and last name from field ID 5, and email from field ID 6
$contact_data = array(
'FirstName' => rgar( $entry, '5.3' ),
'LastName' => rgar( $entry, '5.6' ),
'Email' => rgar( $entry, '6' ),
'Company' => 'CompanyName',
);

$lead_id = wp_fusion()->crm->add_object( $contact_data, 'Lead' );
}

// Replace "1" with the ID of the form
add_action( 'gform_after_submission_1', 'my_gform_after_submission', 10, 2 );
This example runs after a Gravity Form has been submitted and then creates a new lead with the submitted form data, using the add_object() method.
For another example with Salesforce, see this Gist:

#Alternatives
Implementing a custom object switching solution with WP Fusion is usually a complex project.
In some cases it』s better to use a different plugin for your custom objects, and let WP Fusion focus on the bi-directional sync of your user and customer data.

For syncing custom post types with Salesforce objects, we recommend Object Sync for Salesforce.
For syncing WooCommerce orders with Salesforce orders, we recommend WooCommerce Salesforce Integration by CRM Perks.

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

WP Fusion vs….

WP Fusion vs….

#WP Fusion vs Zapier
While WP Fusion and Zapier are both integration tools, they work quite differently.
Zapier is a SaaS (Software as a Service) solution that acts as a middleman between your site and your CRM (as well as many other platforms).
When something is updated in WordPress, it is synced to Zapier』s website, and then Zapier syncs the data on to your desired platform. Depending on your plan there is a delay before the data is synced, and/or limit on how many 「tasks」 you can run each month.
WP Fusion connects your site directly to your CRM or marketing automation platform over the API (nothing goes through our website). Because of this the sync of data is instant, secure, and there are no monthly limits.
In addition to syncing data with your CRM, WP Fusion also includes many options for protecting your WordPress content based on CRM tags, and triggering changes in membership level or course enrollments based on CRM automations. This generally isn』t possible with Zapier because Zapier is configured via zapier.com, not inside your WordPress dashboard.
Is WP Fusion a complete Zapier replacement? No, not really. Zapier connects 3000+ web apps with each other, whereas WP Fusion just connects your WordPress plugins to your CRM.
However, if you』re currently using Zapier to integrate your WordPress plugins (for example WooCommerce or LearnDash) with your CRM, then WP Fusion is likely a better alternative:

Zapier 「Standard」 plan: $19.99 / mo for 750 tasks, with a 15 minute delay
WP Fusion 「Personal」 plan: ~$20.58 / mo for unlimited tasks, with no delay

#WP Fusion vs Membership Plugins
WP Fusion is not a membership plugin (though it can be used as one). Instead, WP Fusion is a framework that connects existing plugins to your CRM and marketing automation platform. This has several benefits over all-in-one systems.
WP Fusion doesn』t reinvent the wheel. Instead of including features like a shopping cart, LMS, members directory, affiliate center, or registration form, WP Fusion integrates with dozens of plugins that are designed specifically for these features. This lets us focus on the integration with your marketing automation system, while other plugins are able to shine doing what they do best.
Flexible. By extending other plugins WP Fusion doesn』t lock you into one way of doing things. If you need to change out a component on your site, or add new functionality, you don』t need to start over from scratch. You can even change CRMs while still keeping your existing content and access rules.
Easy to integrate. WP Fusion integrates seamlessly with your existing content, users, and plugins. This makes setup quick and easy. If you ever decide to stop using WP Fusion, all of your content is still there.
Efficient. WP Fusion is focused on being fast, lightweight, and easy to use. When WP Fusion detects one of our supported integrations, a module is turned on which unlocks features specific to that plugin.
#WP Fusion vs Uncanny Automator
We get asked a lot what the difference is between WP Fusion and Uncanny Automator (and AutomatorWP), since both plugins are 「automation」 solutions for WordPress.
WP Fusion is primarily an integration tool between WordPress and your external CRM or marketing automation platform. You can see a list of our supported CRMs here.
What WP Fusion does is sync your users and customers into your CRM, so you can send them emails, track revenue and page views, run reports, etc.
​Uncanny Automator is a Zapier-like solution but for WordPress plugins. It』s awesome, and we use it on our own websites. You set up a trigger, and then an action— for example 「Buy product X in WooCommerce-> enroll in social group Y in BuddyBoss」. You can see a list of the supported triggers and actions here.
In summary:

WP Fusion links your WordPress plugins with your marketing automation platform
Uncanny Automator links your WordPress plugins with eachother

​Where there is some overlap is that most of the external CRMs we support also have automation capabilities.

For example in this ActiveCampaign automation, WP Fusion has synced a customer』s birthday into a custom field, which triggers the automation. ActiveCampaign then has a date timer to wait until the customer』s birthday, applies a tag to unlock a birthday discount in WooCommerce, and sends an email.​
That kind of thing wouldn』t be possible with Automator, because it links plugins to eachother in real time. It doesn』t have the ability to chain multiple events together with delays and conditions.
On the other hand, while it is possible to use WP Fusion to link plugins together, many times it』s simpler to to use Automator for those tasks.
For example lets say you want to use a Gravity Form submission to enroll someone into a free course. With WP Fusion you would have to already be using an external marketing automation tool, and then you would need to create a form feed, which creates a contact in your CRM and applies a tag that』s set up as an auto-enrollment trigger into the course.
That process is slow and complicated, and may not work if your CRM』s API is slow or offline. But with Automator, the user registration and course enrollment happens instantly.
Another area where WP Fusion is different is with regards to access control features, which Uncanny Automator doesn』t have. WP Fusion can protect content on your site using tags in your CRM, allowing you to create a highly personalized user experience based on that user』s past interactions with you.
Confusing, right? Which plugin should you use?
Both WP Fusion and Uncanny Automator have free versions (here and here respectively). If you』re not sure what you need, a great option is try out both to get a sense of how they work. But as a general guide:
#Use WP Fusion when…

You』re already using an external CRM or marketing automation platform
You want to do email or SMS marketing based on events in WordPress
You want to run automations that happen over a period of time or involve multiple steps
You want to restrict access content on your site using CRM tags

#Use Uncanny Automator when….

You』re not already using an external CRM or marketing automation platform
You want to link plugins together directly using triggers and actions, without requiring a 3rd party service
You want to sync users between two different WordPress sites

WP Fusion and Automator also work really well together, for example in this hypothetical scenario:

When someone registers for an event in The Events Calendar, Uncanny Automator adds the user to a free LearnDash group
Simultaneously, WP Fusion syncs the attendee』s details and the event details to your connected CRM
After the event time has passed, your CRM triggers a followup email, which includes a tracking link pointing to a Gravity Forms survey, which WP Fusion pre-fills with the attendee』s information from your CRM
When the survey form is submitted, Uncanny Automator notifies the LearnDash group leader that there』s been a new survey entry

In that scenario WP Fusion handles the integration with your marketing tool, and Uncanny Automator triggers events between individual plugins.

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

wpf_forms_pre_submission_contact_id

wpf_forms_pre_submission_contact_id

#Overview
This filter is run when WP Fusion is processing a form submission from one of our supported form plugins.
It is triggered after WP Fusion has attempted to locate a contact ID in the CRM for the form submission, but before a contact record is created / updated, and before any tags are applied.
To use the code examples below, add them to your active theme』s functions.php file.
#Alternate filters
For more precise targeting there are two alternate filters with the same arguments:

wpf_{integration slug}_pre_submission_contact_id : Where {integration_slug} is the name of the form integration, for example wpf_gform_pre_submission_contact_id

#Parameters

$contact_id (string|false): The contact ID in the CRM to be updated, or false if no match found
$update_data (array): The data about to be synced to the CRM, in key => value pairs
$user_id (int): The ID of the registered user who submitted the form, or 0 for guest
$form_id (int): The ID of the submitted form

#Examples
#Force all form submissions to create a new contact record
This is a simple example that stops WP Fusion from trying update existing contact records in the CRM from form submissions. All form submissions will create a new contact.
add_filter( 'wpf_forms_pre_submission_contact_id', '__return_false' );
#Force all form submissions to create a new contact record by form ID
This is the same as the example above but only runs on form IDs 22 and 29
function always_create_new_contacts( $contact_id, $update_data, $user_id, $form_id ) {

if ( 22 == $form_id || 29 == $form_id ) {
$contact_id = false;
}

return $contact_id;

}

add_filter( 'wpf_forms_pre_submission_contact_id', 'always_create_new_contacts', 10, 4 );
#Use custom lookup logic for contact records – Infusionsoft
By default WP Fusion uses the first email address found on a submitted form when determining whether to create or update a contact record in your CRM.
In some cases you may want to use more complex rules for determining when a new record should be created.
This example for Infusionsoft attempts to match against the Email Address 2 and Email Address 3 fields in addition to the Email Address field. That means that if the form is submitted and the entered email matches the Email Address 3 field on an existing contact, that contact record will be updated (rather than a new contact record being added).
function wpf_lookup_additional_emails( $contact_id, $update_data, $user_id, $form_id ) {

if ( empty( $contact_id ) ) {

$email = $update_data['Email'];

wp_fusion()->crm->connect();

$query = array( 'EmailAddress2' => $email );
$result = wp_fusion()->crm->app->dsQuery( 'Contact', 1, 0, $query, array( 'Id' ) );

if ( isset( $result[0]['Id'] ) ) {

return $result[0]['Id'];

}

$query = array( 'EmailAddress3' => $email );
$result = wp_fusion()->crm->app->dsQuery( 'Contact', 1, 0, $query, array( 'Id' ) );

if ( isset( $result[0]['Id'] ) ) {

return $result[0]['Id'];

}
}

return $contact_id;

}

add_filter( 'wpf_forms_pre_submission_contact_id', 'wpf_lookup_additional_emails', 10, 4 );
#Use custom lookup logic for contact records – Salesforce
This example for Salesforce only updates an existing contact record if the email address, first name, and last name match. Otherwise a new record will be created.
function wpf_forms_name_lookup( $contact_id, $update_data, $user_id, $form_id ) {

$params = wp_fusion()->crm->get_params(); // get the authentication headers and other API params

// URL-encode the three lookup fields

$email_address = urlencode( $update_data['Email'] );
$first_name = urlencode( $update_data['FirstName'] );
$last_name = urlencode( $update_data['LastName'] );

// this is the SOQL, Salesforce Object Query Language:

$query_args = array(
'q' => "SELECT Id from {wp_fusion()->crm->object_type} WHERE Email = '{$email_address}' AND FirstName = '{$first_name}' AND LastName = '{$last_name}'",
);

$request = add_query_arg( $query_args, wp_fusion()->crm->instance_url . '/services/data/v42.0/query' );
$response = wp_remote_get( $request, $params );

if ( is_wp_error( $response ) ) {

// If an error was encountered, log it
wpf_log( 'error', $user_id, 'Error looking up Salesforce contact: ' . $response->get_error_message() );
return false;

}

$response = json_decode( wp_remote_retrieve_body( $response ) );

if ( empty( $response ) || empty( $response->records ) ) {

// If no match was found, return false so a new contact is created
return false;

}

// Return the ID of the contact that matched the email, first name, and last name
// It's this contact ID that will be updated by the form submission

return $response->records[0]->Id;

}

add_filter( 'wpf_forms_pre_submission_contact_id', 'wpf_forms_name_lookup', 10, 4 );

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

wpf_ecommerce_order_args

wpf_ecommerce_order_args

#Overview
This filter is run by the Enhanced Ecommerce addon before the order data is passed to the CRM for processing. It can be used to override the order details that are synced to the CRM.
To use the code examples below, add them to your active theme』s functions.php file.
#Parameters

$order_args: An array of order data:

order_label: The label, for example 「WooCommerce Order #123」
order_number: The order umber, for example 123
order_edit_link: The link to edit the order in the admin
payment_method: The payment method
products: An array of products and their prices
line_items: An array of line items (discounts, shipping, etc) and their amounts
total: The order total
currency: The order currency
currency_symbol: The order currency symbol
order_date: The order date
provider: The plugin source, for example woocommerce or easy-digital-downloads
status: The order status
user_id: The user ID who placed the order, 0 for guest
user_email: The customer email address

$order_id: The ecommerce order ID

#Examples
#Override order label
This example overrides the order label that』s synced to the CRM.
function alt_emails_for_attendees( $order_args, $order_id ) {

$order_args['order_label'] = 'Custom Label, Order #' . $order_args['order_number'];

return $order_args;

}

add_filter( 'wpf_ecommerce_order_args', 'override_order_label', 10, 2 );

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No

How does licensing work?

How does licensing work?

#Overview
When you purchase WP Fusion, you』ll receive a link to download the plugin, along with a license key. This license key entitles you to one year of automatic updates, as well as unlimited customer support.
#Managing active sites
If you have a Personal or Plus license, you can only have your license key active on one site at a time. You can deactivate a site at any time by going to Settings >> WP Fusion >> Setup in your WordPress admin, and clicking Deactivate next to your license key.
You can also manage your active sites, and deactivate sites, via your account portal on this site.
#License renewals
By default your license will automatically renew each year, giving you access to an additional year of automatic updates and support.
We recommend keeping your license active, so you can get the latest security updates, and have access to support— but you』re under no obligation to do so. WP Fusion will continue to work as normal without an active license.
If you wish to cancel your subscription you can do so at any time via your account.
#License upgrades
You can upgrade your license at any time your account portal on this site. License upgrades are prorated based on the date of your original purchase.
So, for example, if you purchased a Personal license for $247 on January first, and wanted to upgrade to a Professional license six months later, your upgrade cost would be $146.50. Your license would then renew at the Professional level on January first (your original purchase date).
#Licenses for staging or development sites
WP Fusion is fully functional without an active license. It won』t receive automatic updates on your staging environment, but otherwise it will function normally.
If you need to get automatic updates on your staging site, the license system will automatically allow activation on any URL that matches one of these:

localhost
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
*.dev
.*local
dev.*
staging.*
test.*
*.wpengine.com

If you need to receive automatic updates on different staging or test URL, contact our support with the URL you』d like enabled and we can manually put in an exception for you.

#Was this helpful?

Let us know if you liked the post. That』s the only way we can improve.

Yes

No