Skip to Content Skip to Menu

CB register autoaction name generation

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 month 3 weeks ago #338999 by activha
Hello

Is it possible to change the behavior of a Register Autoaction in order to get more readable usernames ?

For now the randomly generated usernames are not easy to remember by our users.

Would you have any idea about this ?

thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 month 3 weeks ago #339000 by krileon
Replied by krileon on topic CB register autoaction name generation
I would recommend giving the auto action a username input if you need readable usernames. There's no functionality for alternating the randomly generated usernames behavior as that's in core CB not in CB Auto Actions. So only way to do this would be to act on onBeforeUserRegistration trigger and change the username before the user is created.


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 month 3 weeks ago #339001 by activha
Replied by activha on topic CB register autoaction name generation
The issue is that this autoaction is used from my web component and I only have the email available at this stage.

How could I use onBeforeUserRegistration trigger to get more readable username with random numbers at the end ?

For instance webuser-12345 ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 month 3 weeks ago #339002 by krileon
Replied by krileon on topic CB register autoaction name generation
Your web component could format a username and send that along with the post data.

How could I use onBeforeUserRegistration trigger to get more readable username with random numbers at the end ?

You'd use a Code action with Method set to PHP and Reference Variables under parameters set to Variable 1. You should then just be able to modify the user object however you like using var1 from the variables array. Example as follows.
Code:
$variables['var1']->set( 'username', 'CUSTOM_USERNAME' );

You don't need to handle any storage logic as this is a trigger fired before storage so modifying the reference variable is enough.


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.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 month 3 weeks ago #339004 by activha
Replied by activha on topic CB register autoaction name generation
That seemed too complicated because it had to be applied only to web component so I switched to username = email

This should work fine for anybody

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

Moderators: beatnantkrileon
Powered by Kunena Forum