club = $club; } public function approve(): bool { if( $this->club->club_state !== 'moderated' ) { return false; } $this->club->club_state = 'visible'; $this->club->save(); /** @var Node $node */ $node = $this->em()->create('XF:Node'); $node->node_type_id = 'Forum'; $node->title = $this->club->title; $node->description = $this->club->description; $node->parent_node_id = \XF::options()->rhpz_club_node_id ?? 0; $node->display_order = 1; $node->save(); /** @var Forum $forum */ $forum = $this->em()->create('XF:Forum'); $forum->node_id = $node->node_id; $forum->allow_posting = true; $forum->save(); $this->club->node_id = $node->node_id; $this->club->save(); $user = $this->club->User; if( $user ){ /** @var ModeratorService $modManage */ $modManage = \XF::app()->service('RomhackPlaza\Master:Club\Moderator', $this->club, $user ); $modManage->addModerator( $error ); } return true; } }