Let me preface this by saying I’m admittedly in way over my head…
Using PHP I’m trying to pass webform submissions over to an external library (for making barcodes, but I don’t think that’s relevant to what I’m screwing up.) I’m using token_replace in the PHP to make usable variables now that I’ve (sort of) learned that’s what needs to be done, after hours of wondering why my variable values were the [token reference] instead of that token’s actual value.
About half of the values I need actually come from the user details, such as “current-user:field_customer_name” – using…
$var = token_replace('[current-user:field_customer_name]', array('node' => $node));
..these work fine, but the other half comes from the webform submission itself, and when trying to do something like:
$var2 = token_replace('[submission:values:date_of_birth]', array('node' => $node));
var2 would still ultimately have the value of [submission:values:date_of_birth] when I pass it through.
These will both echo out the correct values, but when passed to the barcode library using:
$codeContents = '[v1]' . $var . [v2] . $var2;
The (QR) barcode will read “[v1]Mr. Customer [v2][submission:values:date_of_birth]” instead of “[v1]Mr. Customer [v2]04/16/1982”
I’ve been trying to figure it out (and reading plenty) all day, and have no idea if it’s because the array reference is incorrect, this isn’t possible, or I’m screwing something else up.
Long story short; if I’m on the wrong path, how can I use webform tokens in PHP so I get the actual values? (or can’t I?)