Complex sentence: Gilderoy thought that when he had appeared in "The Daily Prophet" with Harry, it had put ideas into his head, and that Harry was handing out signed photos because of him.
Split into simpler sentences: Gilderoy thought that when he had appeared in "The Daily Prophet" with Harry, it had put ideas into his head. He later thought that Harry was handing out signed photos because of him.