Skip to Content Skip to Menu

🕒 Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
🎁 Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

[SOLVED] Keep email and username synced

  • sysopcrew
  • sysopcrew
  • OFFLINE
  • Posts: 74
  • Thanks: 14
  • Karma: 3
7 years 10 months ago - 7 years 10 months ago #292262 by sysopcrew
[SOLVED] Keep email and username synced was created by sysopcrew
I have the username field set to no display on all pages (Registration, Profile, Edit), and fallback for username is set to email. Login is set to email only.

When a user changes their email (I am using CB Reconfirm Email), what's the best way to keep the username synced to the new email? I'm guessing an Auto Action, but I can't figure out the best trigger to use.

onAfterUpdateUser or onAfterUserUpdate? What's the difference? I don't see any triggers specific to CB Reconfirm Email.

Once triggered, then just set username =

--
David Riviera
Last edit: 7 years 10 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
7 years 10 months ago #292283 by krileon
Replied by krileon on topic Keep email and username synced
You'll only want to change the username after they've confirmed the email change. So you'll need to act on the CB Reconfirm Email trigger as follows to do this.

Global
Triggers: reconfirm_onAfterConfirm
Type: Field
User: Automatic
Access: Everybody
Action
Field: username
Operator: Set
Value: [var2_to]

var1 is the user object (before change), var2 is the reconfirm object (e.g. so it contains to, from, etc.. regarding their reconfirmation), and var3 is the confirmation code. The above should set their username to the email they're changing to after they've completely confirmed the change.


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: sysopcrew

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

  • sysopcrew
  • sysopcrew
  • OFFLINE
  • Posts: 74
  • Thanks: 14
  • Karma: 3
7 years 10 months ago #292291 by sysopcrew
Replied by sysopcrew on topic Keep email and username synced
Worked! I didn't see the reconfirm_ trigger at the bottom of the list. Yes, I couldn't figure out how to trigger after the confirmation. Thanks!

--
David Riviera
The following user(s) said Thank You: krileon

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48709
  • Thanks: 8319
  • Karma: 1447
7 years 10 months ago #292296 by krileon
Replied by krileon on topic Keep email and username synced
For anyone curious you can find up to date trigger list below (I've updated the tutorial).

www.joomlapolis.com/documentation/279-community-builder/tutorials/18358-using-cb-triggers

It's only missing some in-development triggers in CB Activity, but once 4.0.0 is released will be sure to update it again. File paths, trigger name, and trigger variables are all included in the tutorial.


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: sysopcrew, lousyfool

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

Moderators: beatnantkrileon
Powered by Kunena Forum