Fixed unique URL handling for URLs that have URLs and other
URL-problematic items. Also improve checks for whether a user had been
"attached" to a document yet.