[SOLVED] Auto Action Question

10 years 1 month ago - 10 years 1 month ago #243528 by rmwalker
[SOLVED] Auto Action Question was created by rmwalker
I'm executing user-specific PHP code to register a user in a back-end system. In my Auto Action, I've selected the "Type" as "Code" and the "Trigger" as "onAfterUserRegistrationMailsSent". The "User" field of the AutoAction has to point to the user receiving the Registration email because I need to retreive other specific user fields for registration in the backend system. I've selected "User" as "Manual" and am using "variable 4". Does this context allow me to use substitution fields in my PHP program so that [cb:userdata field="email" /] would return the email address of the user receiving the Registration Email? I'm not sure where to find what the value of each of the "Manual" variables actually is. Can someone provide some clarity?

Please Log in to join the conversation.

10 years 1 month ago #243565 by krileon
Replied by krileon on topic Auto Action Question
The variables 1-10 relate to the variables the trigger sends CB. If variable 4 is a CB user object for the trigger you're using then it'll execute the action on that user. In order to know what variables 1-10 specifically are for each trigger you need to find and review the triggers source code, but we've a tutorial below with CBs various triggers and their variables.

www.joomlapolis.com/support/tutorials/120-api-usage/18358-using-cb-triggers

Yes, you can use substitutions in the Code action.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 years 1 month ago - 10 years 1 month ago #243589 by rmwalker
Replied by rmwalker on topic Auto Action Question
The autoaction I'd rather use is trigger('onAfterUserApproval', array( $user, true, true)), but I don't see how substitutions would work in that situation since the user is most likely the admin and not the user being approved. With 'onAfterUserApproval', is variable 1 the username of the user that's being approved? If $user is an array, then what are the array members?

Please Log in to join the conversation.

10 years 1 month ago #243591 by krileon
Replied by krileon on topic Auto Action Question
For onAfterUserApproval leave User as Automatic and it'll automatically pick up $user (first variable), which is the user being approved; not the administrator doing the approving. You'd then just use [username] in your code action.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

10 years 1 month ago - 10 years 1 month ago #243594 by rmwalker
Replied by rmwalker on topic Auto Action Question
What other variables are populated with user information for this trigger. Is username the only variable that's available without a lookup? For the user that's been verified, I ultimately need

[username]
[firstname]
[lastname]
[email]

Please Log in to join the conversation.

10 years 1 month ago - 10 years 1 month ago #243605 by rmwalker
Replied by rmwalker on topic Auto Action Question
Based on what I've read. These lines of PHP code will populate my variables with the user's information in my auto action code block. Or have I completely misunderstood:

$username = [username];
$cbUser =& CBuser::getInstance( $user->$username );
$my_email = getField( email, $defaultValue = null, $output = 'csv', $formatting = 'none', $reason = 'profile', $list_compare_types = 0 );
$firstname = getField( firstname, $defaultValue = null, $output = 'csv', $formatting = 'none', $reason = 'profile', $list_compare_types = 0 );
$lastname = getField( lastname, $defaultValue = null, $output = 'csv', $formatting = 'none', $reason = 'profile', $list_compare_types = 0 );

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.879 seconds

Facebook Twitter LinkedIn