Gilderoy Lockhart is Defense Against the Dark Arts teacher in Harry Potter and the Chamber of Secrets. An incredibly puffed-up, self-serving, conceited idiot, Lockhart tries to cast a Memory Charm on Harry and Ron to prevent the world from knowing that he has not actually performed a lot of the impressive deeds that have made him famous. The Memory Charm backfires, and Lockhart loses all recall of, well, everything, up to and including his own name.
Now, it's Book 5, and we see Lockhart again. When Harry, Ron, Ginny, and Hermione go looking for tea at St. Mungo's while visiting Mr. Weasley, they come upon the Spell Damage ward and they recognize Lockhart. Apparently, he has never recovered from the Memory Charm and can't look after himself. He seems quite cheerful, and he automatically assumes that they are all there to ask for autographs. A nurse bustles by and recommends that Harry and the rest visit with Lockhart for a bit. He never gets visitors.
Lockhart has two purposes in Book 5: first, he provides a reason to draw Harry, Ron, Hermione, and Ginny into the Spell Damage ward where they spot the Longbottoms. Second, he provides a very small commentary on the problem of fame. The thing is, Lockhart receives fan mail all the time from people who have read his books. He tells his visitors, "I still receive a very great deal of fan mail ... Gladys Gudgeon writes weekly" (23.181). But even though Lockhart still gets stacks of letters from people who admire him, he doesn't have anyone to visit him at Christmas. He has no friends or family surrounding his bed at St. Mungo's. He is all alone. This makes us wonder what J.K. Rowling thinks of the value of most fan mail....