Subversion Repositories SmartDukaan

Rev

Rev 13532 | Rev 13633 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13532 Rev 13591
Line 71... Line 71...
71
				$user = $this->SocialProfile->User->find('first',array('conditions'=>$conditions));
71
				$user = $this->SocialProfile->User->find('first',array('conditions'=>$conditions));
72
				if(!empty($user)) {
72
				if(!empty($user)) {
73
					$data['user_id'] = $user['User']['id'];	
73
					$data['user_id'] = $user['User']['id'];	
74
				}else{
74
				}else{
75
					//Create a new user and then insert user_id in social_profiles table
75
					//Create a new user and then insert user_id in social_profiles table
76
					$userData = array('email'=>$this->request->data['email'],'username'=>$this->request->data['email'],'first_name'=>$this->request->data['name'],'gender'=>$this->request->data['gender']);
76
					$userData = array('email'=>$this->request->data['email'],'username'=>$this->request->data['email'],'first_name'=>$this->request->data['name'],'gender'=>$this->request->data['gender'],'mobile_number'=>$this->request->data['mobile_number'],'referrer'=>=>$this->request->data['referrer']);
77
					if($this->SocialProfile->User->save($userData)) {
77
					if($this->SocialProfile->User->save($userData)) {
78
						$data['user_id'] = $this->SocialProfile->User->getLastInsertId();
78
						$data['user_id'] = $this->SocialProfile->User->getLastInsertId();
79
					}else{
79
					}else{
80
						$result = array('success' => false, 'message' => $this->SocialProfile->User->validationErrors);
80
						$result = array('success' => false, 'message' => $this->SocialProfile->User->validationErrors);
81
						break;
81
						break;
Line 87... Line 87...
87
				} else {
87
				} else {
88
					$result = array('success' => false, 'message' => 'Social Profile Could Not Be Created','id' => -1);
88
					$result = array('success' => false, 'message' => 'Social Profile Could Not Be Created','id' => -1);
89
				}
89
				}
90
			} else {
90
			} else {
91
				$result = array('success' => true, 'message' => 'Existing Social Profile','id' => $socialProfile['SocialProfile']['user_id']);
91
				$result = array('success' => true, 'message' => 'Existing Social Profile','id' => $socialProfile['SocialProfile']['user_id']);
92
    			}
92
			}
93
		}
93
		}
94
		$this->set(array(
94
		$this->set(array(
95
		    'result' => $result,
95
		    'result' => $result,
96
		    'callback' => $callback,
96
		    'callback' => $callback,
97
		    '_serialize' => array('result')
97
		    '_serialize' => array('result')