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 #249183 by mhs_cb
I'm pretty sure it takes 2 saves for the full update. Here is what I have:

Action: Field
Triggers: onAfterUserUpdate
User: Automatic
Access: Registered
Conditional: None
Field: First Name
Operator: Set (Field=Value)
Value: [cb_custom1] - [cb_custom2]

In the CB Config I have:
Name Style: First and Last Name Field
Name format: Name Only

On the first save I can see the changes for the Last Name field reflected, but not the changes for the First Name field (which is a combination of the 2 custom CB fields). On the second save, the changes from the first save are reflected. I can see this in the User Profile Page Title tab which uses [cb:userdata field="formatname" /], and I can see it in other components that use the formatname.

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 #249188 by krileon
Ensure you're using latest CB Auto Actions (5.1.3). Next ensure you're changing both the fields in a single field action (you should see a + button to far right of field parameters). This should allow the two to update at the same time. There's no reason for it to need a double save unless a second save is overriding the changes (possibility if you're using 2 field actions in a row).


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 #249192 by mhs_cb
I'm using 5.1.3 Auto Actions.

I'm combining both custom fields in the same Auto Action and the same Field Action within. No need to add another Auto Action or another Field Action.

The actual name fields update on the profile, however, the Formatname does not until a second profile update/save is done. The fields in the database update, but the Formatname does not reflect this throughout the site. Ive hard refreshed, but still nothing (a second save is needed). I can show you privately if you like, or privately send you a video/screenshots.

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 - 10 years 1 month ago #249259 by krileon
Format Name doesn't have any storage. It pulls its values from Name, First Name, Middle Name, and Last Name. If you're only updating Name then CBs First, Middle, and Last Name fields have not been updated yet, which is why it's taking multiple stores. If you're using First and Last format then you need to update Name, First Name, and Last Name.


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.
Last edit: 10 years 1 month ago by krileon.

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 #249261 by mhs_cb
I'm currently updating middle name. I sent you a screen capture.

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 #249270 by krileon
You need to also update Name, but you'll probably need an Query action for that if it's not showing up in the field dropdown. Name is stored in the _users database table and is what most 3rd party extensions are going to use (they don't know CBs First/Middle/Last exists). The Format Name field also only uses Name (it automatically splits it using our getNameFormat function) so Name has to be updated too. To do that you could use the below query action (after your field action).

Code:
UPDATE `#__users` SET `name` = '[firstname][middlename][lastname]' WHERE `id` = '[user_id]'


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