Skip to Content Skip to Menu

Auto Action trigger on value change

10 years 3 months ago #246779 by djdesjardins
Auto Action trigger on value change was created by djdesjardins
I've seen it referenced but cannot figure out how to reference an initial value easily. I've seen examples where a "var1..." and "var3..." were used as initial and new values but unclear on how it was either set or known that these were the values of interest.

I can do it, but I created query fields to hold initial values. I don't think this is necessary, is it?

What I want to do is fire an Auto Action when a user saves a change to a particular field in their profile.

Please Log in or Create an account to join the conversation.

10 years 3 months ago #246798 by djdesjardins
Replied by djdesjardins on topic Auto Action trigger on value change
With more digging found appropriate tutorial, and reviewed source
www.joomlapolis.com/support/tutorials/120-api-usage/18358-using-cb-triggers

Still have a question, brain just not wrapping... Let me explain what I believe and ask a clarifying question.

One

$_PLUGINS->trigger( 'onBeforeUpdateUser', array( &$user, &$user, &$oldUserComplete ) )
  1. This is triggered in the Back-End
  2. The first $user is var1_, it is also what gets returned as "Automatic" for AutoAction and is object being updated
  3. The second $user is var2_ is user doing update if not updating your own profile
  4. $oldUserComplete is var3_ and it is the original data for the user object being changed

Two

$_PLUGINS->trigger( 'onBeforeUserUpdate', array( &$user, &$user, &$oldUserComplete, &$oldUserComplete ) )
  1. This is triggered from Front-End
  2. Question - Assuming I am correct so far, what is the second $oldUserComplete?

I think I'm close, just missig a little bit here I think...

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 3 months ago #246839 by krileon
Replied by krileon on topic Auto Action trigger on value change
Use the after profile update trigger and compare var1 to var3. Var 1 being the new user object and Var 3 being the old user object. Example as follows.

[var1_cb_myfield] Not Equal To [var3_cb_myfield]

The above would check if the cb_myfield field value has changed.


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.
The following user(s) said Thank You: nant

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum