As WordPress becomes more of a mainstream website development application, rather than just a blogging tool, there is an increasing need to capture information and pass it to 3rd-party systems. Whenever there is a requirement to integrate WordPress with another system a plugin seems to pop up in quick time to fill the need, but sometimes these plugins just satisfy the most basic of requirements and so some additional customisation is necessary to get exactly the result you want.
One such situation occurred for us this week.
We had a client who wanted to capture information from 3 website forms (including 1 sidebar form) in their WordPress site, and then send this information to their Capsule CRM system and pass the visitor back to a thank you page on their website. The requirement was further complicated by the need to pass a number of custom fields to Capsule.
Our solution was to install the GravityForms plugin, creating the form(s) we needed and then dropping the form shortcode where we needed it on the site. This first bit is standard WordPress / GravityForms stuff. The trickier bit was actually getting the form submission process to kick-off the sending of the form field content to Capsule CRM. We did this by adding the following code to our theme functions.php file.
Strictly speaking, you shouldn’t really be editing your functions.php file – if you update your theme you may well lose your valuable customisations. Instead, call it from your child theme or add it to any ‘custom-‘ type of file (if specified by your theme).
Notes for completing your WordPress Gravity Forms to Capsule CRM integration
- Your Capsule form id goes into line 9;
- Your successful completion url goes into line 10;
- Each of your custom field names gets it’s own line like line 11. You’ll need to match up the field id that Gravity Forms gives each field with the corresponding Capsule CRM custom field name;
- You can repeat this code for each different form that you have on your site, replacing the relevant function and form names;
Of course, there are plenty of other WordPress form plugins, and plenty of other CRMs, but hope fully this will help you get started.