There is a hidden character in the game that can only be gotten by entering a code. However he is NOT needed for this.
First to get this you MUST beat the game, and by that I mean every film, every scene. It's the only way to "unlock" the characters to purchase.
Second you need a decent sum of money, you should have a lot if you've been using the red hats that multiply treasure (and you should).
Now you need to buy every character, and while this sounds easy Lego Pirates have made this a nightmare. You need to find each character in the hub, fight them, beat them (but not don't kill them/explode them) and then buy them.
The problem is who appears in each hub room is set beyond that, the unbought characters are NOT given priority. You will have to hunt for every character and at the end of the game there's always going to be 2-3 that you can't find.
So... the best way to do this is get Jacoby when you can, then go to a screen and use Jacoby to kill explode as many character that you already have bought (they won't have a circle over their character when you approach) people as you can, and use a back up character to fight anyone who does have the circle. Do this until you can't find anyone (and that means blowing up every character you see for a few minutes, there's a few characters that hide as I mentioned). Then go to another hub room.
The hubs I've found that has the unique characters are
The harbor (main room)
The watch tower (right room)
Outside the tavern (left room. Blackbeard appears on the far left)
Blackbeard's tavern (The one you need Blackbeard to open, two of his crew only appeared here for me).
Other areas MIGHT have some characters. But those are the ones I remembers.
While doing this you will get