This one is a doozy for me, and I really need some input / advice.
Basically, I have a client who runs an independent magazine, and they use a system that can output a list of subscribers, and their account numbers in a CSV file.
I'm doing the online version of their magazine using expression engine. When each reader is sent their magazine, attached will be an account number. The client wants them to be able to register on the site, and input their print subscription account number at registration. At this time, they want the system to compare the account number they enter, to the active list of account numbers. If they've entered a valid print account number, then they'll be granted access to the special members-only content.
I'm trying to figure out the best way to approach this, because I'm trying to marry two unrelated systems, and it's not negotiable - this is how they want to do it. The subscriber list must come in from their subscription system, and the reader must have their print magazine before they can validly login and create an account.
They also want it so that if a user's print account number becomes non-active (aka, they no longer subscribe to the magazine), then their account should also be demoted to a lower level.
I've had a few thoughts and approaches - all of them have an issue or big challenge of some sort:
1) Somehow, import all the current account numbers from the CSV, and save them as channel entries. Then, upon registration, user enters their account number into a custom field, which then somehow "checks", and if it's a valid registration, change their member group. If an account number is removed from the "valid" list, then the member will need to be downgraded.
2) Every day, the administrator will use the CSV file to "import" members. As in, accounts will be automatically created and the subscription account number itself will be used AS the username, with a standard password. They like this idea, but they say that in this case they'd want the user to be able to change their username to a friendly name, rather than existing as numbers like the Borg.
In the above case, I'd have to write some sort of script that creates user accounts, and, if necessary, looks for the CHANGE in active subscriptions. Meaning, if you are user 323423, and then one day the admin import shows that account number as missing (no longer active), then downgrade the account.
Fundamentally, I think, I understand the process flow, but I have no idea how to code any of this.. user creation.. validation... cross referencing from a channel data source (magazine subscription account numbers)
It's a frustrating cross of a few different sets of technology. I'm wondering if, perhaps, I'm missing something really straightforward? Or, if my above options are truly the directions I have to go, then HOW do I program this? (as in, example code?? - adding a member programatically? Or at registration time, adding in the subscription field validation? :)
I've looked at the DB structure to see if I can "hack" this together, but the user (member) table really looks like it's very specifically managed by EE.