In Order of the Phoenix, Harry comes across Lockhart in St Mungo's while visiting Mr. Weasley at Christmas. Lockhart is slowly regaining his memory and is childishly proud of being able to write in "joined-up letters." He still enjoys signing autographs and still receives fan mail, although he has no idea why. Lockhart never fully recovers, despite all efforts to cure him.
Gilderoy Lockhart is a narcissistic wizarding celebrity who has written many books on his fabulous adventures encountering dark creatures. In Chamber of Secrets, Lockhart is appointed as Hogwarts' new Defence Against the Dark Arts instructor. He is unpopular amongst most of the staff, particularly Professor Snape; however, he is greatly admired by many others, particularly witches, such as Hermione Granger and Mrs Weasley, who fancy him. Harry dislikes him for a number of reasons: his smarminess, his belief that Harry flew to Hogwarts in a car to seek further attention, his penchant for handing out signed photos of himself, and the trouble he has with simple magic such as healing Harry's broken arm—he accidentally removes all of Harry's arm bones instead. Lockhart is exposed as a fraud and a coward when he attempts to avoid entering the Chamber of Secrets by revealing to Harry and Ron Weasley that he never performed the amazing feats documented in his books, instead stealing other wizards' experiences and erasing their memories. His attempt to use a Memory Charm on Harry and Ron backfires due to his use of Ron's broken wand, and he suffers the permanent near-total loss of his own memory as a result.
Rowling has said that Lockhart is the only character she has ever based on a real-life person. Lockhart was inspired by an unrevealed acquaintance who was "even more objectionable than his fictional counterpart" and "used to tell whopping great fibs about his past life, all of them designed to demonstrate what a wonderful, brave and brilliant person he was."