changed set userID variable to only execute when a user is logged in