×

Error

Please login first

Use email instead username when user register

11 years 9 months ago - 11 years 9 months ago #205954 by dotcom22
hello

When user register on my new J 2.5 site (without need to confirm their email) I would like simply ask:

Firstname
Lastname
Email
Password

That mean I would like to NOT ask any username. Then for login, inside CB Configuration I can set to allow only "Email" for let user login with their email instead to use their username....well.

Now I see CB need anyway to fill the default username field because is a required field in Joomla. The problem for me is I noticed this "missing" username will be composed using Firstname + Lastname. That mean for example if a user register using this data:

Firstname: Mike
Lastname: Foo
Email: mike.foo@domain.com

...is username will become "Mike Foo" and me I would like the Username become his own email address.

It is possible to do that?

The problem after is if user change for any reason his email address, the field Email will contain his new address but the field Username will contain his old address. So is necessary to always check and make equal both value for Email and Username field.

By default CB do not allow this...but I wondering if using Auto-Action or any other plugin is possible and if yes how.


thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

11 years 9 months ago - 11 years 9 months ago #206006 by krileon
CB will add email to username if name and username fields are both removed from registration. The alternative is to use CB Auto Actions with a Field action on after registration trigger to set the username field to [email]. To apply this after profile updates also add the profile update trigger.


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 to join the conversation.

11 years 8 months ago #209192 by dotcom22
hello

Ok I setup your trick and this work well but after reflection I prefer to not replace username with email. The fact is actually I don't plan to show on the site the Username but if for any reason I change my mind later, I will unable to do display username because of course show publicly email of users is not a good idea.

So actually if a user register with the same first and last name of a user already registered, the registration fail because the username is already present in the system (because we have 2 Mike Foo).

So I would like find a trick who allow me to auto-generate a unique username but after making some search it seem nothing is really planned for do that.

Any suggestion please ?

thank

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

11 years 8 months ago #209214 by krileon
You'd need to try using a Query action to update the _users table and set the username to something random using SQL functions. You can generate a random integer in SQL with RAND(). See below SQL documentation for further SQL function and usage information.

dev.mysql.com/doc/refman/5.6/en/index.html


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 to join the conversation.

11 years 8 months ago #209242 by dotcom22
Correct me if I'm wrong but this can be done simply using Auto-Action "field" and append a suffix based on [user_id]. Like that I can get a unique username...

I tested and if I setup this kind of action with trigger onAfterUserRegistration and when a user register, his username become "Mike Foo167". Can you confirm this can work without problem?

The only thing here is instead to get a username composed by first and last name + userid, I would like get only first name + userid. So instead to get "Mike Foo167" I would like get only "Mike167".

it is possible ?

I use Joomla 3.3.6 - CB 2.0.4 - CBSubs 4 - Several Incubator plugins

Please Log in to join the conversation.

11 years 8 months ago #209250 by krileon
Yes, adding a prefix/suffix of user id would also do the trick. If you just want first + id you'd set username to [firstname][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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.369 seconds

Facebook Twitter LinkedIn