Set username on registration as firstname+user id

7 years 8 months ago - 7 years 8 months ago #284485 by crealiagroup
This is my scenario:

NO username required on registration form;
I use also CB Connect to let user create account;
I don't want that username is setted as e-mail for privacy reasons;
If 2 users have the same first and last name then the username "first name last name" can be taken only by 1 person and that's annoying expecially in cases where users connect with Facebook plugin.

I would create an auto action that edit the username as soon as the user is created as: [name][user_id]

I've tryed it and partially worked: setted "onAfterSaveUserRegistration" and in case the user register from the CB form everything works fine but if user registers using CB connect (FB for example) the trigger is not fired.

Also, in the email that the user receive I would have the username as [name][user_id].

How could I do that?

Please Log in to join the conversation.

7 years 8 months ago #284503 by crealiagroup
Replied by crealiagroup on topic Set username on registration as firstname+user id
First solution found myself:

I've setted the CB Connect plugin for Facebook to assign as username the Facebook ID. In this scenario, if user register via CB, then the auto action assign the username as firstname-user_id, meanwhile if user registers via Facebook the username is assigned as facebook_id and autoaction is bypassed.
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

7 years 8 months ago #284513 by crealiagroup
Anyway, is there another way to set the username as "firstname-userid" in case that user registers with Facebook Connect?

Please Log in to join the conversation.

7 years 8 months ago #284517 by krileon
Yes, within CB Connect > Parameters > Registration you can use the "Username Format" parameter to format the username however you like. Additionally supported substitutions are listed below the parameter. So in your case you'd set it as follows most likely.

[profile_firstname]-[facebook_id]

If that doesn't grab the firstname you can try the below.

[firstname]-[facebook_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.
The following user(s) said Thank You: crealiagroup

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.197 seconds

Facebook Twitter LinkedIn