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 drop 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).
PHP code to help integrate WordPress and GravityForms data with Capsule CRM
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 its 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 hopefully, this will help you get started.
Hello I am trying to install this plugin into my website but get the following error message. I really need to integrate this with my site as I’m getting spammed a lot can you help?
Hi Paul.
I’ve just taken a look at this plugin and tried to install it on my server. I couldn’t activate it because there is some code that needs php 5.3. I only have 5.2 on the server I was testing it on, so if you are also on a release less than 5.3 then this will be your problem.
So, you can either get your web host to upgrade to php 5.3 (as recommended by the plugin owner) or try hacking the plugin code to make it work on your php version. To do this, you will need to edit line 12 in the file capsulecrm.php to replace __DIR__ with the full path to your CapsuleCRM plugin folder. Then, in file CapsuleCRMAPI.php replace lines 286 – 301 with this code.
I’m not 100% sure that this plugin will then work without further modifications, but the steps above should get it activated for you.