Upi
Forum Replies Created
-
Hi,
sorry to admit – we’ve looked at your code and couldn’t grasp the logic behind the lines.
According to our best understanding, these are the only line of code the you need to edit:$query = “INSERT INTO TableName (
field1,field2,field3) VALUES (‘{$arr[‘Name’]}’,'{$arr[‘Last name’]}’,'{$arr[‘Email’]}’)”;…
UriCan you please post your code and we’ll refer to it ?
,
I think I see the issue;
Basically the forms are mapped and are being registered with UpiCRM.
The problem I see is with the “Name” field, which is defined as “subfield” with gravity forms:
Easiest solution I believe will be to simply add another field “Last Name” and simplify the current “name” field to collect a simple “name” string.
Will you try that please ?
Thanks
Uri
pleas try the following:
function upicrm_hook($lead_id) { $UpiCRMLeads = new UpiCRMLeads(); $UpiCRMUIBuilder = new UpiCRMUIBuilder(); $UpiCRMFieldsMapping = new UpiCRMFieldsMapping(); $getLeads = $UpiCRMLeads->get_by_id($lead_id); //get lead data $listOption = $UpiCRMUIBuilder->get_list_option(); //get UI options & existing fields $getNamesMap = $UpiCRMFieldsMapping->get_all_by($getLeads->source_id, $getLeads->source_type); //get lead fields mapping $sql_field = ""; $sql_value = ""; foreach ($listOption as $key => $list_option) { foreach ($list_option as $key2 => $field_name) { $value = $UpiCRMUIBuilder->lead_routing($getLeads, $key, $key2, $getNamesMap, true); $arr[$field_name] = $value; } } $query = "INSERT INTO TableName (<code>field1</code>,<code>field2</code>,<code>field3</code>) VALUES ('{$arr['Name']}','{$arr['Last name']}','{$arr['Email']}')"; mysql_query($query); } add_action( 'upicrm_after_new_lead', 'upicrm_hook' );works?
Hi,
please see code below: this action will occur when a new lead is received .function upicrm_hook($lead_id) { $UpiCRMLeads = new UpiCRMLeads(); $UpiCRMUIBuilder = new UpiCRMUIBuilder(); $UpiCRMFieldsMapping = new UpiCRMFieldsMapping(); $getLeads = $UpiCRMLeads->get_by_id($lead_id); //get lead data $listOption = $UpiCRMUIBuilder->get_list_option(); //get UI options & existing fields $getNamesMap = $UpiCRMFieldsMapping->get_all_by($getLeads->source_id, $getLeads->source_type); //get lead fields mapping $sql_field = ""; $sql_value = ""; foreach ($listOption as $key => $list_option) { foreach ($list_option as $key2 => $field_name) { $value = $UpiCRMUIBuilder->lead_routing($getLeads, $key, $key2, $getNamesMap, true); $sql_field.= "<code>{$field_name}</code>,"; $sql_value.= "'{$value}',"; } } $sql_field = rtrim($sql_field, ","); $sql_value = rtrim($sql_value, ","); $query = "INSERT INTO TableName ({$sql_field}) VALUES ({$sql_value})"; mysql_query($query); } add_action( 'upicrm_after_new_lead', 'upicrm_hook' );Hi,
we’ll post a code example soon… a day r two… stay tuned 🙂Hi, and thanks for contacting us.
First – do I understand correctly that the problem occurs on the Admin pages, and not the actual site ?
We’ll be happy to do what we can in order to solve the issue… we’ll need a couple of things:
1. first option – If you’ll share the login/FTP details of your site, we’ll try and solve this on our own.
2. if you can share the theme you purchased with us, for testing purposes solely, we can try and install it on our servers and try to recreate the problem.
3. if you’ll provide us with a contact person from the theme sellers, we’ll work with them in order to solve this.please let us know which option is best for you, we’ll obviously prefer option 1.
thanks
UriWe’re marking it as “resolved”, if you need more assistance, please let us know!
Hi Deb,
as requested – though little delayed – please see code example and explanation bellow:1. Create A function to be called when a lead status changes or when a lead is created. The Function receives the lead ID.
2. Get all lead details by calling function UpiCRMLeads::get_by_id()
3. Get all optional headers including all existing fields by calling function
UpiCRMUIBuilder::get_list_option()
4. Get contact forms fields mapping to UpiCRM fields by calling function UpiCRMFieldsMapping::get_all_by()
5. Code example show nested loop that processes the entire received information and can present the information by using function
UpiCRMUIBuilder::lead_routing()
Code example:function upicrm_hook($lead_id) { $UpiCRMLeads = new UpiCRMLeads(); $UpiCRMUIBuilder = new UpiCRMUIBuilder(); $UpiCRMFieldsMapping = new UpiCRMFieldsMapping(); $getLeads = $UpiCRMLeads->get_by_id($lead_id); //get lead data $listOption = $UpiCRMUIBuilder->get_list_option(); //get UI options & existing fields $getNamesMap = $UpiCRMFieldsMapping->get_all_by($getLeads->source_id, $getLeads->source_type); //get lead fields mapping foreach ($listOption as $key => $list_option) { foreach ($list_option as $key2 => $field_name) { $value = $UpiCRMUIBuilder->lead_routing($getLeads, $key, $key2, $getNamesMap, true); echo "{$field_name}: {$value}<br />"; } } } add_action( 'upicrm_after_lead_change_status', 'upicrm_hook' );Would you need more help / support on this?
please let us know
thanks
UriHi
We’ll be happy to provide a solution. Can you please contact us on
http://www.upicrm.com/contact ?
with more details ?
Thanks
UriHi,
The Information is stored as JSON and returns the ID saved in DB.You can use it to read from DB:
UpiCRMLeads :: get_by_id ($ lead_id)
What is relevant mostly is lead_content.If you want to get all the information (data) by fields of UPI, then it is a little more complex.
You can look for function wp_ajax_excel_output_callback in upicrm_admin_lists file.
There is a loop that starts like this:
foreach ($ getLeads as $ leadObj)
This will certainly be a good starting point…
Does that help, or do you need more assistance?Hi
Have you had the chance to check it out?
Please let us know so we can mark the thread as resolved.
Thanks
UriHi,
getting back to you…!we’ve located version 1.8.3 pre release for you at:
http://www.upicrm.com/wp-content/uploads/2015/06/upicrm-1.8.3.zip
</>It includes hooks in UpiCRM, for the following actions:
1. New leads
2. change lead owner
3. change lead status.this is how it should work:
Action Name: upicrm_after_new_lead Located in: classes/upicrm_leads.php Example of use: function upicrm_hook($lead_id) { echo $lead_id; } add_action( 'upicrm_after_new_lead', 'upicrm_hook' ); Action Name: upicrm_after_lead_change_user Located in: classes/upicrm_leads.php Example of use: function upicrm_hook($lead_id) { echo $lead_id; } add_action( 'upicrm_after_lead_change_user', 'upicrm_hook' ); Action Name: upicrm_after_lead_change_status Located in: classes/upicrm_leads.php Example of use: function upicrm_hook($lead_id) { echo $lead_id; } add_action( 'upicrm_after_lead_change_status', 'upicrm_hook' );——————–
I believe it is “thin”, but hopefully it will answer your need.
If you need more, just let us know.Any feedback – please share.
Thanks
UriHi there,
we’re working on it… we’ll deliver in a couple more days…
Thanks
Uri.