Skip to content

Commit

Permalink
Fix an error when checking for an authenticated users too early befor…
Browse files Browse the repository at this point in the history
…e Craft (and other plugins) are ready
  • Loading branch information
engram-design committed Jan 18, 2023
1 parent 5fe3f7a commit a28f801
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/CpNav.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ private function _registerProjectConfigEventListeners(): void

private function _registerTemplateHooks(): void
{
// We need an authenticated session to proceed further
if (!Craft::$app->getUser()->getIdentity()) {
return;
}

// We need to hook into the CP layout to save some global Twig variables, used in our custom navigation Twig template.
// For Craft, these would already be there, but as we're providing our own template, we need to slot them in.
// We don't actually output the HTML for the nav here, instead it's added via JS as early as possible.
Expand Down
5 changes: 5 additions & 0 deletions src/services/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public function getNavigationHtml(array $variables = []): ?string

public function renderNavigation($context): void
{
// We need an authenticated session to proceed further
if (!Craft::$app->getUser()->getIdentity()) {
return;
}

try {
$view = Craft::$app->getView();

Expand Down

0 comments on commit a28f801

Please sign in to comment.