1

Maybe you guys know if it's possible to create an account when a new user creates a ticket. At this point there are 2 options.

  1. Let user create a ticket based on e-mail address
  2. Let user create an account first

It would be nice if people don't need to create an account manually.
So if they fill in all the fields, an account will be created based on their e-mail address and receive login details for future use.

1

wp_create_user is your friend!

It takes a username, password, and email:

wp_create_user( $username, $password, $email );

And here's an example:

$user_id = username_exists( $user_name );
if ( !$user_id and email_exists($user_email) == false ) {
    $random_password = wp_generate_password( $length=12, $include_standard_special_chars=false );
    $user_id = wp_create_user( $user_name, $random_password, $user_email );
} else {
    $random_password = __('User already exists.  Password inherited.');
}

Since your ticketing system is not a part of WordPress core, and no details are provided, you'll need to provide somewhere that will run code when a new ticket is created, be it a webhook or an action depending on how tickets are implemented.

You can find more information, including examples here

0

As I understand your case, you should try Catchers Helpdesk plugin

Then your customer send you a ticket, the plugin creates an user account and front end. The user will be notified by e-mail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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