Plugin Directory

Changeset 1718629


Ignore:
Timestamp:
08/24/2017 08:08:28 AM (9 years ago)
Author:
teamgate
Message:

Adding ability to post custom fields data to Teamgate API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • teamgate-crm-forms/trunk/teamgate.php

    r1512481 r1718629  
    4444                'authToken' => esc_attr(get_option('teamgate-auth-token'))
    4545            ]);
     46            // reformat custom fields
     47            foreach($posted_data as $index => $item) {
     48                if (strpos($index, 'customFields') !== FALSE) {
     49                    if (empty($posted_data['customFields'])) {
     50                        $posted_data['customFields'] = array();
     51                    }
     52                    $fieldId = str_replace('customFields-', '', $index);
     53                    $posted_data['customFields'][$fieldId] = $item;
     54                    unset($posted_data[$index]);
     55                }
     56            }
    4657            $method = $posted_data['teamgate-entry-handler'];
    4758            $api->$method->create($posted_data);
Note: See TracChangeset for help on using the changeset viewer.