In this story during Second Year Lockhart was assaulting the second year students and wiping their memories, and he actually ended up believing he had done all those things he claimed to have done, which other people had done, after something he was wearing around his neck, which contained his own memories, got smashed when he was sent flying by Snape's disarming charm, and so when he tried to erase the main characters's memories, and it backfired like in canon he ended up erasing all of his memories, and he was left justifiably worse off than in canon, as depicted in Chamber of Secrets, and Order of the Pheonix.