XF 1.4 Check registration name against another database

Hi there.

I am wondering to see if anyone could help me (or give me some suggestions) into incorporating a username check when someone registers a new account. The basic idea is, they fill out the registration form, it gets processed, and during this process, it checks that username against another database/table to see if that name is in that list. If it isn't it refuses with an error, otherwise, it continues on like normal. I've been trying to find a way to do this but haven't yet found out a way to do it.

Any help would be greatly appreciated.