code not working

But… That actually won’t work because what if the user opens the edit profile page when they ARE logged in and then they click on the logout button… they will still be in the logout page…