Plugin Directory

Changeset 899026


Ignore:
Timestamp:
04/21/2014 12:04:01 AM (12 years ago)
Author:
benhays
Message:

Support for single input name fields

Location:
gravity-forms-highrise-crm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gravity-forms-highrise-crm/trunk/gravity-forms-highrise-crm.php

    r804619 r899026  
    44Plugin URI: https://github.com/bhays/gravity-forms-highrise-crm
    55Description: Integrates Gravity Forms with Highrise CRM allowing form submissions to be automatically sent to your Highrise account
    6 Version: 2.1
     6Version: 2.2
    77Author: Ben Hays
    88Author URI: http://benhays.com
     
    163163            "highrise_optin_condition" => "<h6>" . __("Opt-In Condition", "gravity-forms-highrise-crm") . "</h6>" . __("When the opt-in condition is enabled, form submissions will only be exported to Highrise when the condition is met. When disabled all form submissions will be exported.", "gravity-forms-highrise-crm"),
    164164            "highrise_duplicates" => "<h6>" . __("Duplicate Entires", "gravity-forms-highrise-crm") . "</h6>" . __("When a duplicate entry for Highrise is detected, what should happen?", "gravity-forms-highrise-crm"),
     165            "highrise_splitname" => "<h6>" . __("Split First Name", "gravity-forms-highrise-crm") . "</h6>" . __("When using only a single name field, split the value into first and last before submitting to Highrise.", "gravity-forms-highrise-crm"),
    165166            "highrise_note" => "<h6>" . __("Add a Note", "gravity-forms-highrise-crm") . "</h6>" . __("Create a custom note to be added to the contact."),
    166167            "highrise_tags" => "<h6>" . __("Add some Tags", "gravity-forms-highrise-crm") . "</h6>" . __("Add some tags separated by commas to be added to your contact."),
     
    586587            $config['meta']['group'] = rgpost('highrise_group');
    587588            $config['meta']['duplicates'] = rgpost('highrise_duplicates');
     589            $config['meta']['splitname'] = rgpost('highrise_splitname');
    588590            $config['meta']['note'] = rgpost('highrise_note');
    589591            $config['meta']['tags'] = rgpost('highrise_tags');
     
    690692                    <label for="highrise_duplicates" class="left_header"><?php _e("Duplicate entries?", "gravity-forms-highrise-crm") ?><?php gform_tooltip("highrise_duplicates") ?></label>
    691693                    <select name="highrise_duplicates" id="highrise_duplicates">
    692                         <option value="dupe" <?php echo 'selected' ? (isset($config['meta']['duplicates']) &&$config['meta']['duplicates'] == 'dupe') : '' ?>>Add duplicate anyways, and I'll deal with it in Highrise</option>
    693                         <option value="ignore" <?php echo 'selected' ? (isset($config['meta']['duplicates']) &&$config['meta']['duplicates'] == 'ignore') : '' ?>>Don't add duplicate to Highrise</option>
     694                        <option value="dupe" <?php echo (isset($config['meta']['duplicates']) &&$config['meta']['duplicates'] == 'dupe') ? 'selected' : '' ?>>Add duplicate anyways, and I'll deal with it in Highrise</option>
     695                        <option value="ignore" <?php echo (isset($config['meta']['duplicates']) &&$config['meta']['duplicates'] == 'ignore') ? 'selected' : '' ?>>Don't add duplicate to Highrise</option>
    694696                    </select>
    695697                    <p class="description"><?php _e('Duplicates are currently detected by email address only.', 'gravity-forms-highrise-crm') ?></p>
    696698                </div>
     699
     700                <div id="highrise_splitname_container" valign="top" class="margin_vertical_10">
     701                    <label for="highrise_splitname" class="left_header"><?php _e("Split first name?", "gravity-forms-highrise-crm") ?><?php gform_tooltip("highrise_splitname") ?></label>
     702                    <select name="highrise_splitname" id="highrise_splitname">
     703                        <option value="yes" <?php echo (isset($config['meta']['splitname']) &&$config['meta']['splitname'] == 'yes') ? 'selected' : '' ?>>Split first name field into first & last</option>
     704                        <option value="no" <?php echo (isset($config['meta']['splitname']) &&$config['meta']['splitname'] == 'no') ? 'selected' : '' ?>>Add to Highrise as a single field</option>
     705                    </select>
     706                    <p class="description"><?php _e('If using a single name field, split the submission before it is sent to Highrise. This will be ignored if last name is set above.', 'gravity-forms-highrise-crm') ?></p>
     707                </div>
     708
    697709                <?php /*
    698710                <div id="highrise_optin_container" valign="top" class="margin_vertical_10">
     
    11971209        //self::log_debug('Feed: '.print_r($feed, true));
    11981210
     1211        // Split firstname if option is set
     1212        if( $feed['meta']['splitname'] == 'yes' && empty($params['name_last']) )
     1213        {
     1214            self::log_debug('Splitting name before sending to Highrise');
     1215            preg_match('#^(\w+\.)?\s*([\'\’\w]+)\s+([\'\’\w]+)\s*(\w+\.?)?$#', $params['name_first'], $name);
     1216            $params['name_first'] = $name[2];
     1217            $params['name_last'] = $name[3];
     1218        }
     1219
    11991220        $params = apply_filters('gf_highrise_crm_pre_submission', $params);
    12001221
     
    14251446
    14261447            $fields['name_first'] = array('name' => 'First Name', 'required'=>TRUE);
    1427             $fields['name_last']  = array('name' => 'Last Name', 'required'=>TRUE);
     1448            $fields['name_last']  = array('name' => 'Last Name');
    14281449            $fields['company']    = array('name' => 'Company');
    14291450            $fields['title']      = array('name' => 'Title');
  • gravity-forms-highrise-crm/trunk/readme.md

    r804619 r899026  
    22==========================
    33
    4 Version 2.1
     4Version 2.2
    55
    66Send your Gravity Forms submissions to Highrise.
     
    2525
    2626## Changelog
     27
     28### 2.2
     29* Add support for single name inputs and optionally split into first & last before sending to Highrise
    2730
    2831### 2.1
  • gravity-forms-highrise-crm/trunk/readme.txt

    r804619 r899026  
    44Tags: gravity forms, gravityforms, highrise crm, highrise
    55Requires at least: 3.3
    6 Tested up to: 3.5.1
    7 Stable tag: 2.1
     6Tested up to: 3.9
     7Stable tag: 2.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545
    4646== Changelog ==
     47
     48### 2.2
     49* Add support for single name inputs and optionally split into first & last before sending to Highrise
     50
    4751### 2.1
    4852* Fix check_update() method courtesey of David Smith
Note: See TracChangeset for help on using the changeset viewer.