[3.1] Ticket/13138 Only use cookie data when we do not force a user_id

https://tracker.phpbb.com/browse/PHPBB3-13138

3.1 of #3039 to run tests