Plugin Directory

Changeset 676185


Ignore:
Timestamp:
03/04/2013 07:33:44 PM (13 years ago)
Author:
e_durose
Message:

Added additional contact fields for mapping

Location:
dnd-gravity-forms-to-office-autopilot-contact-builder
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • dnd-gravity-forms-to-office-autopilot-contact-builder/trunk/gravity-to-officeAP.php

    r668734 r676185  
    55Plugin URI: http://www.progo.com
    66Description: This plugin allows you to connect a single Gravity form to an Office AutoPilot Contact insert or update.
    7 Version: 1.0
     7Version: 1.1
    88Author: Eric DuRose
    99Author URI: http://www.danddcompany.com
     
    7474    add_settings_field('gvty_oap_State', 'State', 'gvty_oap_State_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
    7575    add_settings_field('gvty_oap_Zip', 'Zip', 'gvty_oap_Zip_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
    76     add_settings_field('gvty_oap_Phone', 'Phone', 'gvty_oap_Phone_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     76    add_settings_field('gvty_oap_Phone', 'Cell Phone', 'gvty_oap_Phone_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     77    add_settings_field('gvty_oap_hPhone', 'Home Phone', 'gvty_oap_hPhone_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     78    add_settings_field('gvty_oap_oPhone', 'Office Phone', 'gvty_oap_oPhone_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     79    add_settings_field('gvty_oap_Fax', 'Fax #', 'gvty_oap_fax_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     80    add_settings_field('gvty_oap_Company', 'Company', 'gvty_oap_company_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     81    add_settings_field('gvty_oap_Title', 'Title', 'gvty_oap_title_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     82    add_settings_field('gvty_oap_Website', 'Website', 'gvty_oap_website_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     83    add_settings_field('gvty_oap_Country', 'Country', 'gvty_oap_country_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     84    add_settings_field('gvty_oap_Birthday', 'Birthday', 'gvty_oap_birthday_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     85    add_settings_field('gvty_oap_LeadSource', 'Lead Source', 'gvty_oap_leadsource_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
     86    add_settings_field('gvty_oap_Question', 'Question', 'gvty_oap_question_setting_string', 'my_gvty_to_oap_plugin', 'gvty_to_oap_settings');
    7787}
    7888
     
    96106    $valid['zip_id'] = $input['zip_id'];
    97107    $valid['phone_id'] = $input['phone_id'];
    98    
     108    $valid['hphone_id'] = $input['hphone_id'];
     109    $valid['ophone_id'] = $input['ophone_id'];
     110    $valid['fax_id'] = $input['fax_id'];
     111    $valid['company_id'] = $input['company_id'];
     112    $valid['title_id'] = $input['title_id'];
     113    $valid['website_id'] = $input['website_id'];
     114    $valid['country_id'] = $input['country_id'];
     115    $valid['birthday_id'] = $input['birthday_id'];
     116    $valid['leadsource_id'] = $input['leadsource_id'];
     117    $valid['question_id'] = $input['question_id'];
    99118    return $valid;
     119   
    100120   
    101121}
     
    352372
    353373
    354 // Map Phone
     374// Map Cell Phone
    355375function gvty_oap_Phone_setting_string(){
    356376    //get option 'Gravity Form Address Id - email_id' from the DB
     
    368388           
    369389           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['phone_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     390    <?php
     391       
     392     }
     393}
     394
     395
     396// Map Home Phone
     397function gvty_oap_hPhone_setting_string(){
     398   
     399    $options = get_option('gvty_oap_options');
     400    $form_id = $options['form_id'];
     401   
     402     $form = RGFormsModel::get_form_meta($form_id);
     403     $fields = array();
     404     ?>
     405     <div id="select_gravity_form_entity">
     406                <select id="add_hphone_id" name="gvty_oap_options[hphone_id]">
     407                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     408     <?php
     409     foreach($form["fields"] as $field){?>
     410           
     411           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['hphone_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     412    <?php
     413       
     414     }
     415}
     416
     417// Map Office Phone
     418function gvty_oap_oPhone_setting_string(){
     419   
     420    $options = get_option('gvty_oap_options');
     421    $form_id = $options['form_id'];
     422   
     423     $form = RGFormsModel::get_form_meta($form_id);
     424     $fields = array();
     425     ?>
     426     <div id="select_gravity_form_entity">
     427                <select id="add_ophone_id" name="gvty_oap_options[ophone_id]">
     428                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     429     <?php
     430     foreach($form["fields"] as $field){?>
     431           
     432           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['ophone_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     433    <?php
     434       
     435     }
     436}
     437
     438// Map Fax Number
     439function gvty_oap_fax_setting_string(){
     440   
     441    $options = get_option('gvty_oap_options');
     442    $form_id = $options['form_id'];
     443   
     444     $form = RGFormsModel::get_form_meta($form_id);
     445     $fields = array();
     446     ?>
     447     <div id="select_gravity_form_entity">
     448                <select id="add_fax_id" name="gvty_oap_options[fax_id]">
     449                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     450     <?php
     451     foreach($form["fields"] as $field){?>
     452           
     453           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['fax_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     454    <?php
     455       
     456     }
     457}
     458
     459// Map Company
     460function gvty_oap_company_setting_string(){
     461   
     462    $options = get_option('gvty_oap_options');
     463    $form_id = $options['form_id'];
     464   
     465     $form = RGFormsModel::get_form_meta($form_id);
     466     $fields = array();
     467     ?>
     468     <div id="select_gravity_form_entity">
     469                <select id="add_company_id" name="gvty_oap_options[company_id]">
     470                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     471     <?php
     472     foreach($form["fields"] as $field){?>
     473           
     474           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['company_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     475    <?php
     476       
     477     }
     478}
     479
     480
     481// Map Title
     482function gvty_oap_title_setting_string(){
     483   
     484    $options = get_option('gvty_oap_options');
     485    $form_id = $options['form_id'];
     486   
     487     $form = RGFormsModel::get_form_meta($form_id);
     488     $fields = array();
     489     ?>
     490     <div id="select_gravity_form_entity">
     491                <select id="add_title_id" name="gvty_oap_options[title_id]">
     492                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     493     <?php
     494     foreach($form["fields"] as $field){?>
     495           
     496           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['title_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     497    <?php
     498       
     499     }
     500}
     501
     502// Map Website
     503function gvty_oap_website_setting_string(){
     504   
     505    $options = get_option('gvty_oap_options');
     506    $form_id = $options['form_id'];
     507   
     508     $form = RGFormsModel::get_form_meta($form_id);
     509     $fields = array();
     510     ?>
     511     <div id="select_gravity_form_entity">
     512                <select id="add_website_id" name="gvty_oap_options[website_id]">
     513                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     514     <?php
     515     foreach($form["fields"] as $field){?>
     516           
     517           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['website_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     518    <?php
     519       
     520     }
     521}
     522
     523// Map Country
     524function gvty_oap_country_setting_string(){
     525   
     526    $options = get_option('gvty_oap_options');
     527    $form_id = $options['form_id'];
     528   
     529     $form = RGFormsModel::get_form_meta($form_id);
     530     $fields = array();
     531     ?>
     532     <div id="select_gravity_form_entity">
     533                <select id="add_country_id" name="gvty_oap_options[country_id]">
     534                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     535     <?php
     536     foreach($form["fields"] as $field){?>
     537           
     538           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['country_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     539    <?php
     540       
     541     }
     542}
     543
     544
     545
     546// Map Birthday
     547function gvty_oap_birthday_setting_string(){
     548   
     549    $options = get_option('gvty_oap_options');
     550    $form_id = $options['form_id'];
     551   
     552     $form = RGFormsModel::get_form_meta($form_id);
     553     $fields = array();
     554     ?>
     555     <div id="select_gravity_form_entity">
     556                <select id="add_birthday_id" name="gvty_oap_options[birthday_id]">
     557                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     558     <?php
     559     foreach($form["fields"] as $field){?>
     560           
     561           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['birthday_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     562    <?php
     563       
     564     }
     565}
     566
     567// Map Lead Source
     568function gvty_oap_leadsource_setting_string(){
     569   
     570    $options = get_option('gvty_oap_options');
     571    $form_id = $options['form_id'];
     572   
     573     $form = RGFormsModel::get_form_meta($form_id);
     574     $fields = array();
     575     ?>
     576     <div id="select_gravity_form_entity">
     577                <select id="add_leadsource_id" name="gvty_oap_options[leadsource_id]">
     578                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     579     <?php
     580     foreach($form["fields"] as $field){?>
     581           
     582           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['leadsource_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
     583    <?php
     584       
     585     }
     586}
     587
     588// Map Question
     589function gvty_oap_question_setting_string(){
     590   
     591    $options = get_option('gvty_oap_options');
     592    $form_id = $options['form_id'];
     593   
     594     $form = RGFormsModel::get_form_meta($form_id);
     595     $fields = array();
     596     ?>
     597     <div id="select_gravity_form_entity">
     598                <select id="add_question_id" name="gvty_oap_options[question_id]">
     599                   <option value="">  <?php _e("Select One", "gravityforms"); ?>  </option>
     600     <?php
     601     foreach($form["fields"] as $field){?>
     602           
     603           <option value="<?php echo $field["id"] ?>" <?php selected(  $options['question_id'], $field["id"] )?> ><?php echo GFCommon::get_label($field) ?></option>
    370604    <?php
    371605       
     
    395629    $zip = $entry[$options['zip_id']];
    396630    $phone = $entry[$options['phone_id']];
     631    $hphone = $entry[$options['hphone_id']];
     632    $ophone = $entry[$options['ophone_id']];
     633    $fax = $entry[$options['fax_id']];
     634    $company = $entry[$options['company_id']];
     635    $title = $entry[$options['title_id']];
     636    $website = $entry[$options['website_id']];
     637    $country = $entry[$options['country_id']];
     638    $birthday = $entry[$options['birthday_id']];
     639    $leadsource = $entry[$options['leadsource_id']];
    397640    $contactTag = $options['oap_tag_name'];
    398641    $sequence = $options['oap_seq_id'];
    399    
    400    
     642    $question = $entry[$options['question_id']];
     643   
     644   
     645    //echo "the state is: " . $state . "<br />";
     646    //print_r($entry);
    401647
    402648//search for users using email address
     
    413659
    414660        update_oap_contact($cID, $contactTag, $sequence);
    415 
     661        //echo "update!!!";
     662        //echo $cID;
    416663
    417664    } else {
    418665   
    419         add_new_oap_contact($fname, $lname, $email, $address, $city, $state, $zip, $phone, $contactTag, $sequence);
    420 
     666        add_new_oap_contact($fname, $lname, $email, $address, $city, $state, $zip, $phone, $hphone, $ophone, $fax, $company, $title, $website, $country, $birthday, $leadsource, $contactTag, $sequence, $question);
     667        //echo "add new!!!";
     668        //echo $cID;
    421669   
    422670    }
     
    459707$response = curl_exec($session);
    460708curl_close($session);
    461 
     709//header("Content-Type: text/xml");
     710
     711
     712//print_r($response);
     713//die();
    462714
    463715if ($response != "<result></result>"){
     
    478730function update_oap_contact ($cID, $contactTag, $sequence){
    479731
    480 $data ='<contact id="'.$cID.'"><Group_Tag name="Sequences and Tags"><field name="Contact Tags">'.$contactTag.'</field><field name="Sequences">'.$sequence.'</field></Group_Tag></contact>';
     732$data ='<contact id="'.$cID.'"><Group_Tag name="Sequences and Tags"><field name="Contact Tags">gtsr</field><field name="Sequences" action="remove">2</field></Group_Tag></contact>';
    481733
    482734$data = urlencode(urlencode($data));
     
    499751$response = curl_exec($session);
    500752curl_close($session);
    501 
     753//header("Content-Type: text/xml");
     754//echo $response;
    502755
    503756}
    504757
    505758//ADD NEW CONTACT
    506 function add_new_oap_contact($fname, $lname, $email, $address, $city, $state, $zip, $phone, $contactTag, $sequence){
     759function add_new_oap_contact($fname, $lname, $email, $address, $city, $state, $zip, $phone, $hphone, $ophone, $fax, $company, $title, $website, $country, $birthday, $leadsource, $contactTag, $sequence, $question){
    507760
    508761$data = '
     
    517770<field name="Zip Code">' . $zip . '</field>
    518771<field name="Cell Phone">' . $phone . '</field>
     772<field name="Home Phone">' . $hphone . '</field>
     773<field name="Office Phone">' . $ophone . '</field>
     774<field name="Fax">' . $fax . '</field>
     775<field name="Company">' . $company . '</field>
     776<field name="Title">' . $title . '</field>
     777<field name="Website ">'.$website.'</field>
     778<field name="Country">'.$country.'</field>
     779<field name="Birthday">' . $birthday . '</field>
     780</Group_Tag>
     781<Group_Tag name="Lead Information">
     782<field name="Lead Source">'.$leadsource.'</field>
    519783</Group_Tag>
    520784<Group_Tag name="Sequences and Tags">
    521785<field name="Contact Tags">'. $contactTag . '</field>
    522786<field name="Sequences">'. $sequence . '</field>
     787</Group_Tag>
     788<Group_Tag name="Contact Us">
     789<field name="Question">'.$question.'</field>
    523790</Group_Tag>
    524791</contact>
     
    543810$response = curl_exec($session);
    544811curl_close($session);
    545 
     812//header("Content-Type: text/xml");
     813//echo $response;
    546814
    547815}
  • dnd-gravity-forms-to-office-autopilot-contact-builder/trunk/readme.txt

    r670556 r676185  
    1 === Gravity Forms To Office Autopilot ===
     1=== ProGo Gravity Forms To Office AutoPilot Contact Builder ===
    22Contributors: Eric DuRose, ProGo, D&D Company
    33Tags: Gravity Forms Add-on, Office AutoPilot, Contact builder
    44Requires at least: 3.0
    55Tested up to: 3.4.2
    6 Stable tag: 1.0
     6Stable tag: 1.1
    77License: GPLv3 or later
    88
    9 Gravity Form + Office Autopilot. Yeah, We ProGo'd That.
     9This plugin allows you to connect a single Gravity form (http://www.gravityforms.com/) to a Office AutoPilot (http://officeautopilot.com/) Contact insert or update.
    1010
    1111== Description ==
    1212
    13 This plugin is an add-on for the Gravity Forms plugin (http://www.gravityforms.com/). It gives you the ability to map a gravity form to your Office AutoPilot (http://officeautopilot.com/) account. This plugin will create a new contact record if the email address in the gravity form submission is unique. If the contact exists the record is updated.
     13This plugin is an add-on for the Gravity Forms plugin (http://www.gravityforms.com/). It give you the ability to map a gravity form to your Office AutoPilot (http://officeautopilot.com/) account. This plugin will create a new contact record if the email address in the gravity form submission is unique. If the contact exists the record is updated.
    1414
    1515Major features in ProGo Gravity Forms To Office AutoPilot Contact Builder 1.0 include:
     
    4444= 1.0 =
    4545* Stable Release
     46
     47= 1.1 =
     48* Added Additional Contact Fields
     49* Home Phone, Office Phone, Fax, Company, Title, Website, Country, Birthday, Lead Source, Question
     50* Country and Lead Source data must match option selections available in your OAP account.
     51* Birthday must be a valid date.
Note: See TracChangeset for help on using the changeset viewer.