Customizing your Badge Value:
To make it simple for someone, Let me explicitly tell the solution for this implementation in Joomla (found through many hours of trial and error testing :).
First make sure the field you want to show on the badge is defined in the list under the label (Administrator\CiviEvent\Event Name Badge Layouts).
create a hook, which is basically a .php file and copy the following code with whatever the variables you want to show in the barcode (inside PHP tags ofcourse) (here in my case I am showing a custom value)*:
function joomla_civicrm_alterBarcode(&$data, $type, $context ) {
if ($type == 'barcode' && $context == 'name_badge') {
// change the encoding of barcode
$data['current_value'] = $data['custom_6'];
}
}
Save it under any name in the a new folder inside media. eg: \media\civicrm\customphp\civicrmHooks.php
Go to Civicrm and define your PHP folder (Administrator\System Settings\Directories) : Custom PHP Directory - [civicrm.files]/customphp/
Now go and find a Event Participant and click on the Badge Print and check the PDF printed. It should have the correct barcode.
I could not find a civicrm way to find the name of the custom field name so what I did was to add the following php code in civicrmHooks.php and go to the badge print page, where it output the variable name list.
foreach($data as $x=>$x_value)
{
echo "Key=" . $x . ", Value=" . $x_value;
echo "
";
}