function register_l($username, $pass1, $pass2, $email, $fname, $lname, $about, $photo, $city, $country, $hide_Amount, $loan_comment, $tnc, $user_guess, &$id, $card_code, $frnds_emails, $frnds_msg, $loan_app_notify, $loan_repayment_credited, $subscribe_newsletter, $referral_code, $lwebsite, $member_type) { global $session, $database, $form, $mailer, $validation; traceCalls(__METHOD__, __LINE__); $validation->validateLenderReg($username, $pass1, $pass2, $fname, $lname, $email, $frnds_emails, $city, $country, $tnc, $user_guess, $card_code, $referral_code, $member_type); if ($form->num_errors > 0) { return 1; //Errors with form } else { $photon = 'exist'; if (!$photo || strlen($photo) < 1) { $photon = "none"; } if (!$lwebsite || strlen($lwebsite) < 1) { $lwebsite = ""; } if (!$lname || strlen($lname) < 1) { $lname = ''; } if (!$fname || strlen($fname) < 1) { $fname = ''; } if ($member_type == 5) { $sub_user_type = LENDER_GROUP_LEVEL; } else { if ($member_type == 2) { $sub_user_type = LENDER_INDIVIDUAL_LEVEL; } } $retVal = $database->addLender($username, $pass1, $email, $fname, $lname, $about, $photon, $city, $country, $hide_Amount, $loan_comment, $tnc, $loan_app_notify, $loan_repayment_credited, $subscribe_newsletter, $lwebsite, $sub_user_type); $id = $database->getUserId($username); if ($referral_code || strlen($referral_code) > 1) { $amount = $database->getReferralCodeamount($referral_code); $txn_id = $database->setTransaction($id, $amount, 'Referral Code Redemption', 0, 0, REFERRAL_CODE, 1); $cookval = md5(time()); $refretVal = $database->addReferralCode($referral_code, $id, $cookval, $txn_id); setcookie("xmtpysp", $cookval, time() + 60 * 60 * 24 * 100, COOKIE_PATH, '', COOKIE_SECURE, true); } if (!empty($id)) { $this->sendWelcomeMailToLender($email); /* these 4 lines added by chetan for redeem gift card in new lender registration */ if (strlen($card_code = trim($card_code)) > 0) { $res = $this->redeemCard($card_code, $id); $_SESSION['giftRedeemResult'] = $res; $_SESSION['giftRedeemError'] = $form->error('cardRedeemError'); } if ($subscribe_newsletter == 1) { // We are probably going to stop sending the monthly newsletter // $this->subscribeLender($email, $fname, $lname); } logger('lender registerd id ' . $id); $lender = $database->getLenderDetails($id); $database->addEvent(NEW_LENDER_INTRO_EVENT, array($email), date("Y-m-d H:i:s", strtotime("+ 1 day"))); if (isset($_SESSION['lender_invite_visit'])) { $invite = "true"; $lender_invite = $this->processLenderInvite($lender, $_SESSION['lender_invite_visit']); if ($lender_invite) { $friend = $database->getLenderDetails($lender_invite['lender_id']); $_SESSION['lender_invite_modal'] = $friend; } unset($_SESSION['lender_invite_visit']); } else { $invite = "false"; } $distinct_id = Mixpanel::getDistinctId(); $isUserId = $database->isUserId($distinct_id); if (!$isUserId) { Mixpanel::alias($id); } Mixpanel::identify($id); Mixpanel::track('Signed up', array('username' => $lender['username'], 'userlevel' => $this->userlevel_to_string($lender['userlevel']), 'email' => $email, 'lender invite credit' => $invite)); } return $retVal; } }