* Create a new ticket
* This function creates a new ticket
* @since 1.0.0

This function creates a new ticket. The information for this ticket will be delivered by $_POST['t'] and filtered by sts-create-new-ticket-post before they are processed. First the function checks, if a subject a message and so on are delivered. If an error occurs, the function stops. With the filter sts-create-new-ticket-errors you can hook in and determine yourself if an error occured.

If the user is not logged in, the function will check if there is already a user with the given email address. In this case, the user will be asked to login before he can proceed. If the email address is unknown, the user will be registered. Usually, his email address will be used as username. With the filter sts-createuser-username you can define the username yourself. With the filter sts-createuser-password you can alter the randomly generated password. The usermeta data are filtered with sts-createuser-usermeta. After the user has been registered the action sts-createuser-after will be performed. Now, the new user will be automatically signed in. With sts-loginuser-securecookie you can define, if a secure cookie shall be used. You will find more information in the WordPress Codex: wp_signon().

A welcome message will be send, which informs the user about his password, username and so on. If you want to alter the email text, you can rely on the filter sts-userregister-welcome-email-body. If you want to alter the subject of the email, you can use sts-userregister-welcome-email-subject.

Now the function will create the ticket. The arguments, which will be passed to wp_insert_post() are filtered by sts-createticket-args. After the ticket has been created, the ticket agent will be assigned (see sts-standard-ticket-agent) and the action sts-createticket-after will be performed.