1

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.

or

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.

Help!

Thanks, Glen

1
  • I'm still really stuck on this one... The challenge is that even if I use an external DB to store the valid codes, I still don't know how to somehow make something happen when the user registers.. should I write an extension? Hook into the registration process? I really need an experienced EE dev to let me know how they'd go about handling this.
    – GlenRhodes
    Jun 24, 2013 at 20:20

2 Answers 2

1

I'd suggest using one of the two add-ons available for adding registration code functionality.

There is two commercial add-ons for this purpose out there that I can see: Invitations and Registration Codes

I haven't tried out either of them, and you'll still have to work on the import side, which shouldn't be too difficult. But at least these add-ons should handle the validation portion for you.

1
  • Ahh.. very interesting. I'll take a look at those.
    – GlenRhodes
    Jun 17, 2013 at 20:03
1

Without thinking about it too much I would just create a totally separate database table that contained all the valid subscription codes.

Then when a user wants to validate you can do a lookup from that table to find a matching ID. If you need to take it further you can then have that ID either stored in a custom member field or else store their member ID against the code within the separate table.

Maybe then run a cron job every day/week/month to perform a check and demote any accounts that no longer have active subscription IDs.

Like I said, I didn't think on it too much but I would probably avoid any tampering in the EE tables and keep the subscription stuff outside of EE then build some PHP scripts around the system (or get the publisher's systems to update the table as and when needed).

EDIT: Looks like I missed the bit about registering the users. There was an API style add-on announced recently that might help. When I recall the name of it I will update this post.

UPDATE: The API add-on I was thinking of is Open API http://www.putyourlightson.net/open-api It may be of use to you for creating Members etc.

2
  • Hmm.. yes, I guess technically I don't need to keep the "active" account numbers in a channel really.. I just need to write my own php code and create a DB that gets updated weekly. It's just the user/member access stuff that I don't know how to begin coding. And looking at the EE docs, I don't specifically see how I would piggy back onto the registration process, and/or run a cron job that makes changes to registered users.
    – GlenRhodes
    Jun 17, 2013 at 20:01
  • That API looks promising, but its "member" based functionality seems to be "read only".. so you can read all about members, but creating them is a different story.
    – GlenRhodes
    Jun 18, 2013 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.