There are zero cheat codes to unlock characters in LEGO Harry Potter: Years 1–4 or Years 5–7. Every character is earned through in-game progression.
Search IGN, GameFAQs, or TrueAchievements for "All Character Tokens Locations" guides specific to your game (Years 1-4 or 5-7). They list level, area, and required spell/character.
Buy the Character Studs Red Brick early (in the Gringotts vault). Every enemy kill drops studs → fast currency for token purchases.
Enjoy the hunt—finding tokens is the game.