The script user/editadvanced.php uses special value of userid = -1 for the case when a new user is being created. Such a value passes the non-empty check and would lead to "invaliduser" error.