Handling registration form submission

Once the user fills in the data and clicks the Submit button, we have to execute quite a few tasks in order to register a user in the WordPress database. Let's figure out the main tasks for registering a user:

  • Validating form data
  • Registering the user details
  • Creating and saving the activation code
  • Sending e-mail notifications with an activate link or redirecting the user for payments based on the selected user type

We will be using a separate function called register_user to handle form submission. Validating user data is one of the main tasks in form submission handling. So, let's define the register_user function using the init action inside the class constructer, as shown in the following code: ...

Get Wordpress Web Application Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.