I'm working to integrate PayPal's Instant Payment Notification with WordPress to create users when subscriptions are paid for.
I want it to go like this:
- The user clicks on a subscribe button on my site (a non-WP page) that links them to PayPal (easy, I used PayPal's button maker in my business account).
- The user purchases a subscription using PayPal (done).
- PayPal sends me data at a page on my site with payment information. I send back verification that I've received the notification (done, with a little help from the PayPal developer's forum).
- I write all the data I get from PayPal to two new tables I've created in my WP database so I can keep a record of transactions (done).
- Here's where I'm stuck - now I need to automatically create a user from my non-WP page.
I'd like to just use wp_create_user to insert everything, but I'm not sure what files I need to include to grab the right classes/functions. I've looked everywhere I can think of and tried at least a dozen different things with no success.
Can I just do an insert directly into the wp_user table? If so, do I need to MD5 the password? Do I need to write data to wp_usermeta as well?
Are there other processes I need to make sure I take care of? I know I'll need to check for existing usernames, email addresses, etc., but I should be able to take care of that.
Basically, I just need to know everything that needs to happen to create a user from outside of a WP page.