/** * @service affiliate_email_notification write * @param $fields */ public function save(Gpf_Rpc_Params $params) { $form = new Gpf_Rpc_Form($params); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_on_new_sale", $this->getFieldValue($form, "aff_notification_on_new_sale"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_on_change_comm_status", $this->getFieldValue($form, "aff_notification_on_change_comm_status"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_on_subaff_signup", $this->getFieldValue($form, "aff_notification_on_subaff_signup"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_on_subaff_sale", $this->getFieldValue($form, "aff_notification_on_subaff_sale"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_on_direct_link_enabled", $this->getFieldValue($form, "aff_notification_on_direct_link_enabled"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_daily_report", $this->getFieldValue($form, "aff_notification_daily_report"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_weekly_report", $this->getFieldValue($form, "aff_notification_weekly_report"), Gpf_Session::getAuthUser()->getAccountUserId()); Gpf_Db_Table_UserAttributes::setSetting("aff_notification_monthly_report", $this->getFieldValue($form, "aff_notification_monthly_report"), Gpf_Session::getAuthUser()->getAccountUserId()); $form->setInfoMessage($this->_("Email notifications saved")); return $form; }
public function setMatrixHeight($height) { Gpf_Db_Table_UserAttributes::setSetting(self::MATRIX_HEIGHT, $height, $this->user->getAccountUserId()); }
protected function setQuickLaunchSetting($setting) { Gpf_Db_Table_UserAttributes::setSetting('quickLaunchSetting', $setting, $this->getAccountUserId()); }
private function saveTrackingOption(Gpf_Rpc_Form $form) { Gpf_Db_Table_UserAttributes::setSetting(Pap_Settings::OVERWRITE_COOKIE, $form->getFieldValue("overwriteCookie"), $this->user->getAccountUserId()); }
public function getUserAttributeWithDefaultValue($attributeName, $defaultValue) { try { $value = Gpf_Db_Table_UserAttributes::getSetting($attributeName); } catch (Gpf_DbEngine_NoRowException $e) { $value = $defaultValue; Gpf_Db_Table_UserAttributes::setSetting($attributeName, $defaultValue); } return $value; }
/** * @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); }
protected function setDefaultLanguage() { Gpf_Db_Table_UserAttributes::setSetting(Gpf_Auth_User::LANGUAGE_ATTRIBUTE_NAME, Pap_Branding::DEFAULT_LANGUAGE_CODE, $this->getAccountUserId()); }