Changeset 2198774
- Timestamp:
- 11/22/2019 11:12:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mplus-intercom-subscription/trunk/includes/class-mplus-intercom-subscription-public.php
r1917369 r2198774 95 95 $fields = $_POST['fields']; 96 96 97 // echo "<pre>"; print_r($fields); echo "</pre>";98 // exit();99 100 97 foreach ( $fields as $field ) : 101 98 if( $field['name'] == 'honeypot' ) : … … 115 112 $response['message'] = __( 'Something Wrong.', 'mplus-intercom-subscription' ); 116 113 else : 117 try { 114 $company = $intercom->companies->getCompanies( [ 115 'name' => $submitted_fields['name'] 116 ] ); 118 117 119 $company = $intercom->companies->getCompanies( [ 120 'name' => $submitted_fields['name'] 121 ] ); 118 if( property_exists( $company, 'id' ) ): 122 119 $company_fields = [ 123 120 'id' => $company->id, … … 132 129 $response['message'] = __( 'Company already exists. Company Information updated.', 'mplus-intercom-subscription' ); 133 130 $response['success'] = 0; 134 135 } catch ( Exception $e ) { 136 131 else: 137 132 $company_fields = [ 138 133 'name' => esc_attr( $submitted_fields['name'] ), … … 148 143 $creator_user = $intercom->users->create( [ 149 144 'email' => $submitted_fields['email'], 150 'name' => ucwords( $company->name) . ' Creator',145 'name' => ucwords( trim( $submitted_fields['name'] ) ) . ' Creator', 151 146 'companies' => [ $company_fields ] 152 147 ] ); … … 155 150 $response['success'] = 1; 156 151 $response['message'] = __( 'Company Registration Completed.', 'mplus-intercom-subscription' ); 157 }152 endif; 158 153 endif; 159 154 wp_send_json( $response ); 160 155 161 156 die(); 162 163 157 } 164 158
Note: See TracChangeset
for help on using the changeset viewer.