Stop function when user is not logged in/out.