I know there are a few questions on registration forms but I think mine differs a bit as I haven't found an answer through searching.
I'm making a simple subscribe widget that takes a user's email and adds it to the WordPress Users table as a subscriber.
It begins with a simple form with just an email input and submit. The form's action is to a php file in my plugin folder, ajax-signup.php
. I'm using ajax to post the form data to this file which then "registers" the email address and returns an ajax response.
Older plugins just included the registration.php
file which gave all the required functions to the ajax php file in order for it to perform the registration (check email validation, write to the database etc) as the file exists outside WP. What do I need to include, or what superior method is there that will allow me to do this? Maybe a function inside the WP environment rather than a standalone file? I'm not sure how to use ajax in this way though...