function isApprovedMerchantAdmin() { $groups = MerchantGroupDOD::get_approved_groups(); return $this->owner->inGroups($groups); }
function onAfterWrite() { parent::onAfterWrite(); $mainGroup = MerchantGroupDOD::get_main_group(); if ($mainGroup && $this->MerchantGroupCode()) { if ($this->CanEditType != 'OnlyTheseUsers') { $this->writeToStage('Stage'); $this->doPublish(); } } }
function save($data, $form) { $member = Member::currentUser(); if ($member) { try { $form->saveInto($member); $member->write(); $member->Groups()->add(MerchantGroupDOD::get_main_group()); $form->sessionMessage(_t('MerchantAdminAccountPage_Controller.EDIT_SUCCESS', 'Your personal details have been saved successfully.'), 'good'); $this->notify($member, "updated"); } catch (ValidationException $e) { $form->sessionMessage(_t('MerchantAdminAccountPage_Controller.EMAIL_ERROR', 'Your personal details could not be saved because the email is already been used.'), 'bad'); $this->notify($member, "updated", true); } return Director::redirectBack(); } $form->sessionMessage(_t('MerchantAdminAccountPage_Controller.EMAIL_ERROR', 'You need to be logged in to update your details.'), 'bad'); $this->notify($member, "updated", true); return Director::redirectBack(); }