Please Log in or Create an account to join the conversation.
Always treat substitutions in code as a string. It'll do the substitution before the PHP code is parsed and executed. So you'd need to do the below for example.1. How am I supposed to use substitutions within the PHP code?
Somthing simple like: $test = [username];
return $test;
You need to use var1-10. So for example [var1] would be the first variable the trigger provides. Count to $allFields and that'd be the variable number to use next to var.2. How do I get access to a triggers function variables? For example trigger onBeforeDisplayUsersList has variable $allFields which I want to alter. What is complete code to access this variable?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
This is not working as expected for me.krileon wrote:
Always treat substitutions in code as a string. It'll do the substitution before the PHP code is parsed and executed. So you'd need to do the below for example.1. How am I supposed to use substitutions within the PHP code?
Somthing simple like: $test = [username];
return $test;
Code:return '[username]';You need to use var1-10. So for example [var1] would be the first variable the trigger provides. Count to $allFields and that'd be the variable number to use next to var.2. How do I get access to a triggers function variables? For example trigger onBeforeDisplayUsersList has variable $allFields which I want to alter. What is complete code to access this variable?
Please Log in or Create an account to join the conversation.
fields like name, username, email, and user_id are present in every install so I can only advise you on those, but you can substitute in generally any field within CB > Field Management. For all other substitution usage please see the below tutorial.It is not clear to me what fields I can substitute, and how. I want to include the URL of the site in the resulting email, and have tried [cb:url location="..."] and [SITEURL], and neither work. Is there now a third form of CB variables at play here?
For trigger variables you need to compare the trigger used against the below tutorial to see its variable list or find it in source.How / where can I look up what the variables are that can be substituted in CB Auto Actions?
The coding is not the same as writing normal PHP. The output is surrounded by ob_start and ob_clean_end. This means the output is isolated to avoid conflicts or problems. So to actually return something you'll probably need to echo the results first then set the output parameter to return, var dump, etc.. Basically try the below.When I do a return [var4] or return '[var4]' with return var_dump it does not output the variable as requested. What am I doing wrong?
Please Log in or Create an account to join the conversation.
krileon wrote: So to actually return something you'll probably need to echo the results first then set the output parameter to return, var dump, etc.. Basically try the below.
Code:echo '[username]';
Please Log in or Create an account to join the conversation.