public function __construct($userId) { parent::__construct(); if (!OW::getUser()->isAuthenticated()) { $this->setVisible(false); } $creditService = USERCREDITS_BOL_CreditsService::getInstance(); $amount = $creditService->getGrantableAmountForUser(OW::getUser()->getId()); $form = new USERCREDITS_CLASS_GrantCreditsForm(); $form->getElement('userId')->setValue($userId); $form->getElement('amount')->setValue($amount); $this->addForm($form); }