Check for Logged In User on Public Page


I would like to show a top menu when a user is logged in across my app similar to the user info bar built in to knack.

This works fine on the pages that require a login but on the public pages it disappears.

When I try to retrieve the user data myself using Knack.getUserAttributes(); using these scenes rendering as the trigger, I get the result ‘No user found’.

I can’t use page rules on these pages since they are public.

I just want the user to see they are logged in and have a link to their account page even if they are currently on a public page.

Not certain about this but you could try storing the users name and I’d in session variables using sessionStorage.setItem - and the display somewhere in the app.

Hi @JBS,

I use the event trigger for scene-render.any and it works. Then I inject the top menu on every page if it’s not found.

Happy to help you out if you would like, just let me know.