Thanks I found your article very helpful.
Since I'm not interesting to add a bar code,but only generate an unique user id for every user that submit the form,I simplified the procedure in three steps as follows:
1. I added this code in the "On Submit before" box:
<?php
if ( ! $mainframe->isSite() ) { return; }
JRequest::setVar('ident', generateIdent());
/*
function to generate a random alpha-numeric code
using a specified pattern
*
* @param $pattern string
* @return string
*/
function generateIdent($pattern='AA9999A')
{
$alpha = array("A","B","C","D","E","F","G","H",
"J","K","L","M","N","P","Q","R","S","T","U","V","W",
"X","Y","Z");
$digit = array("1","2","3","4","5","6","7","8","9");
$return = "";
$pattern_array = str_split($pattern, 1);
foreach ( $pattern_array as $v ) {
if ( is_numeric($v) ) {
$return .= $digit[array_rand($digit)];
} elseif ( in_array(strtoupper($v), $alpha) ) {
$return .= $alpha[array_rand($alpha)];
} else {
$return .= " ";
}
}
return $return;
}
?>
2. The following code in the Email template(sent to user):
<div>Your code: {ident}</div>
3. And this code in the "After submit text" box:
<div>Your registration code is: {ident}</div>
Could you tell me if the steps above are correct or If I forgotten something?