public function addCommission(Pap_Contexts_Signup $signupContext) { if (($user = $signupContext->getUserObject()) == null) { return; } $campaignId = Gpf_Settings::get(SignupActionCommissions_Config::AFTER_SIGNUP_ACTION_CAMPAIGNID); $actionCode = Gpf_Settings::get(SignupActionCommissions_Config::AFTER_SIGNUP_ACTION_CODE); if ($actionCode == '') { Gpf_Log::error('SignupActionCommissions plugin: No Action code set'); return; } $saleTracker = new Pap_Tracking_ActionTracker(); $action = $saleTracker->createAction($actionCode); $action->setAffiliateID($user->getId()); $action->setStatus($user->getStatus()); $action->setOrderId(SignupActionCommissions_Config::DEFAULT_ORDER_ID); if ($campaignId != '') { $action->setCampaignID($campaignId); } try { $saleTracker->register(); } catch (Gpf_Exception $e) { Gpf_Log::error('SignupActionCommissions plugin: '.$e->getMessage()); } }
private function sendNotificationToMerchant(Pap_Contexts_Signup $context) { $context->debug('Sending notification email to merchant started'); $context->debug('Notification on new affiliate signup email is enabled, sending to address: '.Pap_Common_User::getMerchantEmail()); $this->sendMerchantNewUserSignupMail($context->getUserObject(), Pap_Common_User::getMerchantEmail()); $context->debug('Sending notification email to merchant ended'); }
public function afterSignupFailed(Pap_Contexts_Signup $signupContext) { $form = $signupContext->getFormObject(); if ($form->getFieldError('username') == '') { return; } try { $userId = $this->getUserId($form->getFieldValue('username')); } catch (Gpf_Exception $e) { Gpf_Log::debug('SignupToCampaignPlugin: user with username '.$form->getFieldValue('username').' does not exist'); return; } if ($this->signUserToCampaign($userId, $form)) { $form->setInfoMessage($this->_('You have been successfully signed up')); $form->setErrorMessage(''); $form->setFieldError('username', ''); $form->setSuccessful(); } }
/** * @anonym * @service * @param $fields * @return Gpf_Rpc_Form */ public function add(Gpf_Rpc_Params $params) { $context = Pap_Contexts_Signup::getContextInstance(); $context->debug(' Saving user started'); $context->setParametersObject($params); $this->isFromApi = $params->get('isFromApi') == Gpf::YES; $form = $this->addUser($params); $context->setUserObject($this->getAffiliate()); $context->setFormObject($form); if ((!$form->isSuccessful()) || ($this->getAffiliate() == null)) { $context->debug(' STOPPING, Error saving new user - did not pass the validation? Error message: '.$form->getErrorMessage()); Gpf_Plugins_Engine::extensionPoint('PostAffiliate.signup.afterFail', $context); } else { $context->setUserObject($this->getAffiliate()); $this->sendEmails($context); Gpf_Plugins_Engine::extensionPoint('PostAffiliate.signup.after', $context); } $context->debug("Signup processing ended"); return $form; }
public function sendMail(Pap_Contexts_Signup $context) { $mail = new AutoResponsePlus_Mail(); $mail->setUser($context->getUserObject()); $mail->addRecipient(Gpf_Settings::get(AutoResponsePlus_Config::REMOTE_CONTROL_EMAIL)); $mail->sendNow(); }
/** * @param $email * @param $context * @return Pap_Affiliates_User */ private function createUserFromEmail($email, $context) { $context->debug('Loading affiliate by email'); $emailValidator = new Gpf_Rpc_Form_Validator_EmailValidator(); if (!$emailValidator->validate($email)) { if (!$emailValidator->validate(urldecode($email))) { $context->debug(' AutoRegisteringAffiliates - Creating affiliate stopped, not valid email address: ' . $email); return null; } $email = urldecode($email); } try { return Pap_Affiliates_User::loadFromUsername($email); } catch (Gpf_Exception $e) { if (!Pap_Common_User::isUsernameUnique($email)) { $context->debug(' AutoRegisteringAffiliates - Creating affiliate stopped, email address is used for another user: '******''); $user->setLastName(substr($email, 0, strpos($email, '@'))); //$user->setSendNotification(false); $user->save(); $signupForm->setDefaultEmailNotificationsSettings($user); $signupContext = Pap_Contexts_Signup::getContextInstance(); $signupContext->setUserObject($user); $merchantNotificationEmails = new Pap_Signup_SendNotificationEmails(); $merchantNotificationEmails->process($signupContext); $context->debug(' AutoRegisteringAffiliates - New Affiliate created successfully, email: ' . $email); Gpf_Db_Table_UserAttributes::setSetting(self::AUTO_REGISTERED_AFFILIATE, Gpf::YES, $user->getAccountUserId()); } return Pap_Affiliates_User::loadFromUsername($email); }
/** * @return Pap_Contexts_Signup */ public function getContextInstance() { if (self::$instance == null) { self::$instance = new Pap_Contexts_Signup(); } return self::$instance; }
public function afterSignup(Pap_Contexts_Signup $signupContext) { $campaignsIds = $this->getCampaignsIdsFromString(Gpf_Settings::get(SignupToPrivateCampaigns_Config::CAMPAIGNS_IDS)); foreach ($campaignsIds as $campaignId) { $this->signUserToCampaign($signupContext->getUserObject()->getId(), $campaignId, $signupContext->getFormObject()); } }
public function sendMail(Pap_Contexts_Signup $context) { $mail = new AWeber_Mail(); $mail->setUser($context->getUserObject()); $mail->addRecipient(Gpf_Settings::get(AWeber_Config::AUTORESPONDER_ADDRESS)); $mail->sendNow(); }
private function sendBeforeApprovalEmail(Pap_Contexts_Signup $context) { $context->debug(' Sending before-approval email to affiliate started'); $context->debug('Before-approval email is enabled, sending to email address: '.$context->getUserObject()->getEmail()); $this->sendNewUserSignupBeforeApprovalMail($context->getUserObject(), $context->getUserObject()->getEmail(), $context); $context->debug('Sending before-approval email to affiliate ended'); }