Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function sync_crm_fields() {
- // Load built in fields first
- // require dirname(__FILE__) . '/admin/ontraport-fields.php';
- // $built_in_fields = array();
- // foreach( $ontraport_fields as $index => $data ) {
- // $built_in_fields[$data['crm_field']] = $data['crm_label'];
- // }
- //asort($built_in_fields);
- if( !$this->params)
- $this->get_params();
- // Get custom fields
- $crm_fields = array();
- $request = "https://api.ontraport.com/1/objects/meta?format=byId&objectID=0";
- $response = wp_remote_get($request, $this->params);
- $body = json_decode(wp_remote_retrieve_body( $response ));
- error_log(print_r($body, true));
- foreach($body['data']['fields'] as $key => $field_data) {
- $crm_fields[$key] = $field_data['alias'];
- }
- asort($crm_fields);
- wp_fusion()->settings->set('crm_fields', $crm_fields);
- return $crm_fields;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement