Jump to content
X2Community Forums

data not displayed in Web Lead


Recommended Posts

Hi All,


 


I'm a New to this X2CRM.


 


i have a wordpress and X2CRM installed in one Instance. i want to post the data in X2CRM whenever a customer submit a contact us form from WP.


 


For Reference i used : http://wiki.x2crm.co...acker_Front_End


 


Below are works i done so far.


 


1)  i had created a sample template (First name,Last Name,phone,background info). then i took the embedded script and applied in a new page called testing in WP. it was successful.


 


2) As per the legacy guide, in order to capture the lead form i had created contactform.php and modified the script as per our Instances. PFA


  i have placed APIModel.php file in the same location.


 


3) when i try to submit the form in WP(contact us) i'm getting a message saying "Message received". when i login to X2CRM back end i could see a test.txt file holding the values which got posted from WP.


 


After that when i check the database/X2CRM application i couldn't find that record. is there anything i missed?


 


any additional steps i need to perform? Help here would be really appreciated!


 


Thanks in advance,


 


***************************************************************************************


This is the script file


 


<?php

require 'APIModel.php';

 

$attributes = $_POST;

$contact = new APIModel('admin','API KEY given','https://mydomain/dummy1/index.php');

 

$fieldMap = array( // This map should be of the format 'your_fieldname'=>'x2_fieldname',

    'first_name'=>'firstName',

    'last_name'=>'lastName',

    'mobile'=>'phone2',

    'information'=>'backgroundInfo',

);

#$contact->attributes = $attributes;

foreach($attributes as $key=>$value){

   if(isset($fieldMap[$key])){

        $contact->{$fieldMap[$key]}=$value; // Found in field map, used mapped attribute

    }else{

        $contact->$key=$value; // No match anywhere, assume it's a Contact attribute

    }

}

file_put_contents('test.txt', json_encode($_REQUEST) );

if(isset($_POST['x2_key'])){

    $contact->trackingKey=$_POST['x2_key'];

 

}

$contact->actionCreate();

// Call API to create contact

Header('Location: https://mydomain/wp-admin');// Redirect to homepage

 

?>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...