Skip to Content Skip to Menu

Auto Actions - On Profile Edit, Copy CB FIeld to a Different CB Field

  • mhs_cb
  • mhs_cb
  • OFFLINE
  • Posts: 53
  • Thanks: 0
  • Karma: 0
10 years 1 month ago #249118 by mhs_cb
Can I use this to update the Formatted Name?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 1 month ago #249119 by krileon

Will this trigger work when a moderator updates a profile or does it have to be the user to update their own profile?

Yes if you use both the frontend and backend trigger (see the dropdown next to the Triggers input).

And can I have spaces or dashes in between fields? for some sort of separation?

Yes, you can add whatever strings you want to it. Example as follows.

[cb_field1]-[cb_field2]-[cb_field3]

Can I use this to update the Formatted Name?

No, that field isn't stored anywhere. It's called a calculated field, which means its value is calculated from PHP and doesn't exist in the database. You'd need to alter the Name, First Name, Middle Name, or Last Name fields.


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 or Create an account to join the conversation.

  • mhs_cb
  • mhs_cb
  • OFFLINE
  • Posts: 53
  • Thanks: 0
  • Karma: 0
10 years 1 month ago #249123 by mhs_cb
Seems to work great. Except for this:

It seems that when I alter the name fields, the updating of the FormatName doesnt take effect right away, and I have to resave.

I'm guessing this is because the FormatName is calculated on the spot (upon saving the profile), and the name field alteration occurs after the save.

Is there a different trigger that I can use to alter the name fields and THEN save, so that the FormatName takes effect on the first save?

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

  • mhs_cb
  • mhs_cb
  • OFFLINE
  • Posts: 53
  • Thanks: 0
  • Karma: 0
10 years 1 month ago #249124 by mhs_cb
Is there an Index somewhere that explains what each trigger is exactly?

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

  • mhs_cb
  • mhs_cb
  • OFFLINE
  • Posts: 53
  • Thanks: 0
  • Karma: 0
10 years 1 month ago #249126 by mhs_cb
Can I use the "onBeforeUserUpdate"?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8283
  • Karma: 1443
10 years 1 month ago #249168 by krileon

Seems to work great. Except for this:

It seems that when I alter the name fields, the updating of the FormatName doesnt take effect right away, and I have to resave.

I'm guessing this is because the FormatName is calculated on the spot (upon saving the profile), and the name field alteration occurs after the save.

Is there a different trigger that I can use to alter the name fields and THEN save, so that the FormatName takes effect on the first save?

It shouldn't take a double save or anything of the sort. My guess is you aren't altering the correct name fields based off the display mode you're using. If you've the display set to First and Last then you need to alter those fields. You may need to use a Query action to alter the Name in _users though.

Is there an Index somewhere that explains what each trigger is exactly?

No, not yet. There's just the below reference tutorial with a list of triggers and their variables. We try to name the triggers to be self explanatory.

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

Can I use the "onBeforeUserUpdate"?

No, you should be using the after profile update triggers.


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum