I am building a site with CB & CB Subs where users will register and be assigned a username. Their username will be their last name, first initial, and if that exists, add a number (beginning with 2). For instance:
John Smith = smithj
James Smith = smithj2
Joseph Smith = smithj3
I am not sure how to get just the first letter of first name, and how to add the incremented number. I would love to show the generated username on the registration page to the user, but less important as long as they get the login.
Only way to do that is with CB Auto Actions acting on the after registration trigger with a Code action that modifies the username. Alternatively you can try doing it with a database query in a Query action. Both should allow you to detect existing username and increment as needed, but both will require you to code these usages.
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.
Thanks for the response. It doesn't sound too hard to set up an auto action, but I'm not sure how to just get the first letter from the first name.
I'll do some reading up on the plugin's general usage but if you're able to advise on this particular part (or the use case) I would also appreciate that.
CB Auto Actions comes with format functions, which you can enable under the parameters tab. One of them will let you grab the first letter of the firstname using the below for example.
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.