Add-on Validate User has an active subscription from another system (Using MySQL)

I need a small add-on developed.

At the moment I add users manually to XenForo (Yeah.. I need to automate that ... That'll be job 2).

Users register through another system buy buying a subscription. When I add them as a user to XenForo, I also add their user id from that system in a hidden custom user field.

What I need is an add-on that is triggered when the user signs into XenForo that will make a database query to check if the user has an active subscription. (Both the XenForo and other system are on the same server).

This check should happen only if a XenForo user is part of a certain XenForo usergroup.

The actual MySQL query is really simple, and will return a 1 or a 0.

If the user does not have an active subscription an html message should be shown to that user.

Hope that makes sense. It's pretty simple.

I need this done as soon as possible.

Thanks in advance