Topic-icon Custom username - don't include the '.' in the full name username

Active Subscriptions:

None
Hi,
How do I modify the core files so that the username is created without the '.'?
The '.' is causing me some problems with SEF URLs generated by SH404SEF.
I know there's an option for first 3 letters, but the full name would suit me better...
Thanks,
Matt
The topic has been locked.
Support Specialist
Matt,

Look at the /libraries/sourcecoast/utilities.php file for the getAutoUsername method. Around line 425, you should see the following line of code which you can alter as desired:
$prefix = $firstName . "." . $lastName;

I think that will be the only place that you will need to edit this, but let me know if this doesn't work for you.

-Melissa
The topic has been locked.
Active Subscriptions:

None
Hi Melissa,
I can't actually see where /libraries/sourcecoast/utilities.php is... is this a new file in a new location for the latest version?
I think I'm one behind, but have made a few custom edits, so don't want to go backwards on what I've already done...
Where is it located?
Cheers,
Matt
The topic has been locked.
Support Specialist
This file has been in JFBConnect for years. Make sure you're not looking in the components folder at its library subfolder. Go to YOUR_PUBLIC_HTML_ROOT/libraries/sourcecoast/utilities.php
The topic has been locked.
Active Subscriptions:

None
Got you... thanks!

Last one - is it possible to import the name from Facebook as First Name and Last Name separately instead of just the name?

Cheers,
Matt
The topic has been locked.
Support Specialist
Facebook does provide multiple ways to import the name - First Name, Middle Name, Last Name, and Full Name. If you are using a Social Profile (in the JFBConnect > Profiles area), then you will have the option to map these Facebook fields to the fields in your third party extension as desired. If you are referring to the standard Joomla name field, we don't have any ability to separate that into first and last name fields and always import it as First Last.

-Melissa
The topic has been locked.
Active Subscriptions:

None
OK, thanks - I thought it would have to be a K2 based thing...

Found the area to remove the '.' now...

Is it possible to use the full first name and then just an initial of the second name, so just the first letter? Sorry to mess you around!

Could I just use $lastInitial:
$lastInitial = SCStringUtilities::substr($lastName, 0, max(1));

Or would I need:
$lastInitial = SCStringUtilities::substr($lastName, 0, max(1, 6 - $firstLength));

What happens if two people have the same automatically-generated username - does it add a number on the end?

Thanks,
Matt
The topic has been locked.
Support Specialist

Is it possible to use the full first name and then just an initial of the second name, so just the first letter?

I don't see why you can't do that. You would just need
$lastInitial = SCStringUtilities::substr($lastName, 0, 1);

The other block of code with the max and the 6 as the max length of the resulting string is because we're putting together 3 characters from the first name and three characters from the last name for the 'firlas' option

What happens if two people have the same automatically-generated username - does it add a number on the end?

Yes, if you look down around line 450, you can see a call to the method 'getUsernameUniqueNumber' which does what its name implies.

-Melissa
The topic has been locked.