MDL-36804 Assign: Fix undeclared global $USER and undefined variable $userid