With WP Fusion it’s possible to display data from your CRM in WordPress, allowing you to personalize your site for logged-in users using data from their CRM contact record.
Welcome back, your next exam date is 9/9/2020.
Your assigned advisor is Jim Jones, your learning style is Auditory.
Using WP Fusion’s user_meta shortcode, you can display any data in your site’s database for the current user.
You can see all the available meta field keys on the Contact Fields list in the WP Fusion settings.
The keys in the Meta Field column can be used to display a user’s data without any extra steps. For example to display the current user’s first name, the shortcode would be
However, you may have data that only exists in your CRM, not in WordPress. To display that data, you’ll first have to create a place to store the data in WordPress, and then use WP Fusion to load the data from your CRM.
#Managing custom fields
Before WP Fusion can load a custom field from your CRM, it needs a place to store the data on your site. For an overview on how data is synced between WordPress and your CRM, see the Syncing Contact Fields documentation.
An easy way to create a new field is to use a plugin that lets you manage custom fields for users, such as User Meta Pro, or Advanced Custom Fields. Or if you’re using a membership plugin like BuddyPress or MemberPress, these plugins have options for managing profile fields.
Once you’ve created a field to store your custom data, locate it on the Contact Fields list in the WP Fusion settings, and select a corresponding field in your CRM to enable the field for sync.
In this case, we’ve used User Meta Pro to create a field with key
new_user_meta_field, and linked it to the Test Custom Field Two field in ActiveCampaign.
#Managing custom fields without a plugin
It’s also possible to register a new field in your database using just WP Fusion. Scroll down to the bottom of the Contact Fields list, and in the Additional Fields section, enter a unique key for the new field.
Select a corresponding custom field in your CRM from the dropdown on the right, and save the settings to enable the new field for sync.
#Loading the data
Now that you have the custom field created and linked with the corresponding CRM field, you need to load the data into WordPress. There are a few ways to do this:
- Pull user meta: From the Advanced tab in the WP Fusion settings you can run a Pull User Meta operation, which will load any enabled fields from your CRM into WordPress for all your users. More info on that here.
- Webhooks: If you’re updating the custom field in your CRM over time, you can create an automation that sends a webhook back to WP Fusion when a contact has been modified, using the
?wpf_action=updatemethod. This will load the updated values for that specific contact, and they can be displayed in WordPress. More info on webhooks here.
- User meta shortcode: By using the
[user_meta]shortcode with the parameter
sync_if_empty="true", WP Fusion will connect to your CRM one time to load updated data for that field in case it encounters an empty value in WordPress.
- Update meta shortcode: The [wpf_update_meta] shortcode can also be used to refresh the current user’s stored metadata from their CRM contact record when a page is viewed. To use the shortcode, put it above any
[user_meta]shortcodes on the page so the data has been loaded by the time those shortcodes are executed. Note that the
[wpf_update_meta]shortcode will slow down the page load by a few seconds, so it’s recommended to use it sparingly.
- Update meta URL parameter: You can append
?wpf-refresh=metato any URL on your site to force-load the user’s custom fields from your CRM. For more information, see the shortcodes documentation.
- Login meta sync: You also have an option to load a user’s metadata from your CRM each time they log in, by enabling the option for Login Meta Sync.
Whichever method you use to load the data, the WP Fusion logs will show the data being loaded from your CRM into the user’s metadata in WordPress.
In this case, the
new_user_meta_field we created earlier has loaded a value of
http://test.com from ActiveCampaign.
Now if we use the [user_meta] shortcode, that value can be output on a page. For example
Your personalized results can be found at [user_meta field="new_user_meta_field"]
Would be output as
Your personalized results can be found at http://test.com.