示例#1
0
    private function setUserVariables() {
        if ($this->user == null) {
            return;
        }

        $this->setUserCustomFields($this->user);
        $parentUser = $this->user->getParentUser();
        if ($parentUser != null) {
            $this->setUserCustomFields($parentUser, self::PARENT_PREFFIX);
        }

        $this->setVariable('userid', $this->user->getId());
    }
示例#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];
    }