Return a unique number to the customer after apply

2020-02-13 06:41发布

问题:

I'm making a web site with Wordpress, in which there is a form that has to be filled by customers. I want for every customer that will apply, after complete the filling and get the success message, to get via email a unique number and then contact with the company for the rest procedures. I'm also using contact-form-7 plugin for the form. Any idea or any plugin that could do this automatically? Even if code is needed, let me know! Thanks in advance!

回答1:

You could use the contact-form-7-dynamic-text-extension plugin.

Install the plugin, add

    /* Generate Quote Ticket */
function genTicketString() {
    return substr(md5(uniqid(mt_rand(), true)), 0, 8);
}
add_shortcode('quoteticket', 'genTicketString');

to your functions.php and add

Your Reference number: [dynamictext ticket "quoteticket"]

to your form in contact form 7. (or make this field invisible through css)

Lastly, add [ticket] to your e-mail body.

Found this solution on http://wordpress.org/support/topic/contact-form-7-generating-reference-number and was written by AMCD.