Where/When is a user created and inserted into the DB during reg?

Permalink
Hopefully my question won't be too loaded...

I'm attempting to hook into a PayPal API during registration. I've tried several things, but can't seem to figure out precisely where, in register.php, a user is created and inserted into the database. My goal is to hook the PayPal API during registration and run a user's credit card before the user is actually created. And, if there is a problem with the credit card, fail the user creation and insert to the database.

Like I mentioned, I've tried a few things already but can't seem to figure out where to put my API call. I'm not editing concrete/controllers/register.php, I copied it from there to /controllers so don't worry, I'm not editing a core file.

Any help is appreciated.

tash
 
curtis replied on at Permalink Reply
curtis
$ grep -R 'insert into Users' *

leads to matches in:
concrete/models/userinfo.php:

looks like the add() and addSuperUser() methods in the userinfo model are interesting. Would be called statically like: UserInfo::add(...

$ grep -R 'UserInfo::add' *

results:http://pastie.org/1416166

edit: the results in the pastie are all in the core concrete/ dir.
ScottC replied on at Permalink Reply
ScottC
you'll want to hook into the event on_user_add under concrete5 events. You'll probably have to hook into this after they make a payment(ie, they make a payment, they are returned to your login page, you already set the session key or associated the user in some way from the payment to their email etc), then you add the user to the respective group if they are in the paid table or however you are handling it.