[SOLVED] Can I use this hack for email as username?

11 years 3 months ago - 11 years 3 months ago #151682 by rebreanu
Hello. I found an article regarding email as username in Community Builder:

"This problem came very frequently when you are using Joomla community builder extension. So here is a simple hack for Email as Username

Go to

/administrator/components/com_comprofiler/library/cb/cb.tables.php

Locate: function saveSafely( &$array, $ui, $reason )

Change line 1135

From

$this->username = $this->name;

to

$this->username = $this->email;



That's it Enjoy ;) "

I think this is for older version of CB, because I can't find that function anymore in CB 1.3.1

Can this hack be implemented safely (because of the '@' character in username)? Will this hack affect others modules functionality?

Thank you.

Please Log in to join the conversation.

11 years 3 months ago - 11 years 3 months ago #151688 by nant
CB 1.3.1 -> Configuration -> General:
Login field type: (set this to email if you want)

Please Log in to join the conversation.

11 years 3 months ago #151694 by rebreanu
Replied by rebreanu on topic Re: Can I use this hack for email as username?
σας ευχαριστώ nant for your quick answer.

I wish to get rid of username field from registration, or make some how the username field to have same value as (or link automatically with) user ID from the database user table, because the user ID is unique and since I will use real names all over my site and the username field will by hidden. As Kyle has advised me, kunena will help me customize the appearance of user profile WITHOUT showing the username, I only need to make somehow the username field disappear from registration.

I have read the 186 pages of docs (by the way, great work there!)

Please Log in to join the conversation.

11 years 3 months ago - 11 years 3 months ago #151697 by nant

rebreanu wrote: σας ευχαριστώ nant for your quick answer.

I wish to get rid of username field from registration, or make some how the username field to have same value as (or link automatically with) user ID from the database user table, because the user ID is unique and since I will use real names all over my site and the username field will by hidden. As Kyle has advised me, kunena will help me customize the appearance of user profile WITHOUT showing the username, I only need to make somehow the username field disappear from registration.

I have read the 186 pages of docs (by the way, great work there!)


If you just follow the setting in previous response and edit the username field to mark it to not show during registration and to not show on profile, you should get the effect you want.

Your users will have to login using their email and the username field will not appear during registration or on their profile.
The following user(s) said Thank You: rebreanu

Please Log in to join the conversation.

11 years 3 months ago #151908 by rebreanu
Replied by rebreanu on topic Re: Can I use this hack for email as username?
Ok. I followed the instruction (thank you) and yes, it's 80% working, but there is this problem:

First John Smith can register on the website without username field on registration (in CB user manager his username looks like 'John Smith' - yes, with space between 'John' and 'Smith' but this is not a problem as long is not breaking links with SEF activated). When second John Smith try to register on the website, he gets a "This username/password already in use, please try another." error message.

Is it possible for the CB script to look in to the database user table on registration to check if it finds an already registered John Smith with the username 'John Smith', just add a number after the new username e.g. 'John Smith2' in order to allow registration to as many possible John Smith are out there?

Please Log in to join the conversation.

11 years 3 months ago #151932 by krileon
CB will only use email as username if the Name AND Username fields are blank. I believe the best approach is to simply use professional subscriber CB Fields or CB Queries to update the username to whatever you're needing after registration. You could also develop a new CB plugin to do this for you using CB triggers in a new plugin, more on trigger usage at the following URL.

www.allmysocials.com/tutorials/item/228-event-triggers


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

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.203 seconds

Facebook Twitter LinkedIn