| Line 67... |
Line 67... |
| 67 |
unset($data['gender']);
|
67 |
unset($data['gender']);
|
| 68 |
$this->response->type('json');
|
68 |
$this->response->type('json');
|
| 69 |
$this->layout = 'ajax';
|
69 |
$this->layout = 'ajax';
|
| 70 |
$conditions = array('social_id'=>$this->request->data['id'],'type'=>$this->request->data['type']);
|
70 |
$conditions = array('social_id'=>$this->request->data['id'],'type'=>$this->request->data['type']);
|
| 71 |
$socialProfile = $this->SocialProfile->find('first',array('conditions'=>$conditions));
|
71 |
$socialProfile = $this->SocialProfile->find('first',array('conditions'=>$conditions));
|
| - |
|
72 |
$docsSubmitted=false;
|
| 72 |
//If Social profile doesn't exist
|
73 |
//If Social profile doesn't exist
|
| 73 |
if(empty($socialProfile)) {
|
74 |
if(empty($socialProfile)) {
|
| 74 |
//Check if user with same email is registered and if so just add his profile
|
75 |
//Check if user with same email is registered and if so just add his profile
|
| 75 |
if(!empty($this->request->data['email'])) {
|
76 |
if(!empty($this->request->data['email'])) {
|
| 76 |
$conditions = array('email'=>$this->request->data['email']);
|
77 |
$conditions = array('email'=>$this->request->data['email']);
|
| Line 155... |
Line 156... |
| 155 |
$result = array('success' => false, 'message' => "Email is missing",'mobileRequired'=>$mobileRequired,'referrerRequired'=>$referrerRequired);
|
156 |
$result = array('success' => false, 'message' => "Email is missing",'mobileRequired'=>$mobileRequired,'referrerRequired'=>$referrerRequired);
|
| 156 |
break;
|
157 |
break;
|
| 157 |
}
|
158 |
}
|
| 158 |
} else {
|
159 |
} else {
|
| 159 |
//If Social Profile exists, do not update referrer and email
|
160 |
//If Social Profile exists, do not update referrer and email
|
| 160 |
$docsSumbitted=false;
|
- |
|
| 161 |
$userData = array('id'=>$socialProfile['SocialProfile']['user_id'],'first_name'=>$this->request->data['name'],'gender'=>$this->request->data['gender'],'profile_pic'=> $this->request->data['profile_pic']);
|
161 |
$userData = array('id'=>$socialProfile['SocialProfile']['user_id'],'first_name'=>$this->request->data['name'],'gender'=>$this->request->data['gender'],'profile_pic'=> $this->request->data['profile_pic']);
|
| 162 |
//Check for utm parameters
|
162 |
//Check for utm parameters
|
| 163 |
if(!empty($this->request->data['utm_source'])){
|
163 |
if(!empty($this->request->data['utm_source'])){
|
| 164 |
$userData['utm_source'] = $this->request->data['utm_source'];
|
164 |
$userData['utm_source'] = $this->request->data['utm_source'];
|
| 165 |
}
|
165 |
}
|
| Line 191... |
Line 191... |
| 191 |
$uid=$socialProfile['SocialProfile']['user_id'];
|
191 |
$uid=$socialProfile['SocialProfile']['user_id'];
|
| 192 |
$res = $this->SocialProfile->query("select * from user_docs where id=$uid");
|
192 |
$res = $this->SocialProfile->query("select * from user_docs where id=$uid");
|
| 193 |
$docsSumbitted = !empty($res);
|
193 |
$docsSumbitted = !empty($res);
|
| 194 |
}
|
194 |
}
|
| 195 |
$data['user_id'] = $socialProfile['SocialProfile']['user_id'];
|
195 |
$data['user_id'] = $socialProfile['SocialProfile']['user_id'];
|
| 196 |
$result = array('success' => true, 'message' => 'Existing Social Profile','id' => $socialProfile['SocialProfile']['user_id'],'mobileRequired'=>$mobileRequired,'referrerRequired'=>$referrerRequired, 'docsSumbitted'=>$docsSumbitted);
|
196 |
$result = array('success' => true, 'message' => 'Existing Social Profile','id' => $socialProfile['SocialProfile']['user_id'],'mobileRequired'=>$mobileRequired,'referrerRequired'=>$referrerRequired);
|
| 197 |
}
|
197 |
}
|
| 198 |
}
|
198 |
}
|
| 199 |
$this->updateSaholicUser($data['user_id'],$this->request->data['email']);
|
199 |
$this->updateSaholicUser($data['user_id'],$this->request->data['email']);
|
| - |
|
200 |
$result['docsSubmitted'] = $docsSubmitted;
|
| 200 |
$this->set(array(
|
201 |
$this->set(array(
|
| 201 |
'result' => $result,
|
202 |
'result' => $result,
|
| 202 |
'callback' => $callback,
|
203 |
'callback' => $callback,
|
| 203 |
'_serialize' => array('result')
|
204 |
'_serialize' => array('result')
|
| 204 |
));
|
205 |
));
|