public function save() { $firstChange = $this->isFirstChangeStatus(); parent::save(); if ($firstChange && $this->getSendNotification()) { $this->sendUserEmails(); } if ($firstChange && $this->getStatus() == Gpf_Db_User::APPROVED) { $this->updateStatusSignupAndReferral(); Gpf_Plugins_Engine::extensionPoint('PostAffiliate.affiliate.firsttimeApproved', $this); } }
/** * @return Pap_Common_User or null */ public function getParent(Pap_Common_User $child) { $parentUserId = $child->getParentUserId(); if (!isset($this->parentUserCache[$parentUserId])) { if (is_array($this->affiliatesInDownline)) { $this->affiliatesInDownline[] = $child->getId(); if (in_array($parentUserId, $this->affiliatesInDownline) || $child->getId() == $parentUserId) { $child->setParentUserId(''); $child->save(); $this->parentUserCache[$parentUserId] = null; return null; } } $this->parentUserCache[$parentUserId] = $child->getParentUser(); } return $this->parentUserCache[$parentUserId]; }