示例#1
0
    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);
        }
        
    }
示例#2
0
	/**
	 * @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];
    }