Fix bug, bad performance using api_is_coach(). Set value in variables and $_SESSION -refs BT#8403