Topic-icon Truncate name

Active Subscriptions:

None
14 years 2 weeks ago #22876 by sbouloc
Truncate name was created by sbouloc
Hello,

I use automatic registration and got the user full name displayed. Is it possible to have the user first name + 1st letter of Last Name (ie John D. instead of John Doe)?
Here I am using the user's name instead of username because username looks like fb_1234567890 which is not really attractive. And I don't wan't them to go thru the normal registratration process to keep the FB Registration convenient.

Thank you.
The topic has been locked.
Support Specialist
14 years 2 weeks ago #22890 by alzander
Replied by alzander on topic Truncate name
Stéphane,
(Moving this to the Joomla 2.5 forums area)
There's a few things to discuss here. First, you can change the default username that is created in the JFBConnect Configuration area. Instead of fb_12345, you can use 'first.last' or firlas (first 3 chars of first and last name). Then, with that as the username, you can use the shorter or prettier username in the SCLogin module.

If that doesn't work for you, I can come up with a quick code change that will truncate the last name to John D., if you'd prefer that for display purposes.

Just let ms know,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 2 weeks ago #22931 by sbouloc
Replied by sbouloc on topic Truncate name
Hello alzander,

the first.last option is too complete. Name is too long and I want my members to have a little privacy. As for the firlas option, I feel they have too much privacy (sorry I don't mean to be picky :rolleyes: ). If you can make a quick code change, I will welcome it.

I temporary changed the config to first.last, the changes will take effect for new members only? Actual members still have the previous fb_1234567890 username or will it change when they next login?

Thank you.
The topic has been locked.
Support Specialist
14 years 2 weeks ago #22934 by alzander
Replied by alzander on topic Truncate name
The update to usernames is for new members only. Changing old member names can be problematic if it's done automatically because some extensions won't detect the change, and if users need their username for something, they may not be aware it's updated.

So, re-reading your last post, it sounds like you want the Username to be "First L.", or are you wanting their "Name" field to be that? Depending on what you want, the answer will change.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 2 weeks ago #22936 by sbouloc
Replied by sbouloc on topic Truncate name
I didn't think this could be done with the Name field. But that option would be nice:
"Name" field = First L
The topic has been locked.
Support Specialist
14 years 2 weeks ago #22938 by alzander
Replied by alzander on topic Truncate name
That's what I thought you originally meant, actually. Yes, it's possible (and should be pretty easy). So to make sure:
Username - You sound comfortable leaving this as John.Doe
Full Name - You'd like "John D."

If that's the case, edit the /components/com_jfbconnect/controllers/loginregister.php file. Search for 'createFacebookOnlyUser'. You'll find a big block of code, and one line (about 15 lines into it) will look like:
$fullname = $fbUser['name'];
Change that to:
$fullname = $fbUser['first_name'] . ' ' . substr($fbUser['last_name'], 0, 1) . ".";
Hope that helps, and obviously test! You'll also need to make that change manually as you update JFBConnect in the future.

Keep us posted on how that goes,
Alex
The topic has been locked.
Active Subscriptions:

None
14 years 2 weeks ago #22939 by sbouloc
Replied by sbouloc on topic Truncate name
This is great alzander. I really appreciate your level of support here. Thank a lot. Now I have to wait for a new member to signin and see the changes.
The topic has been locked.
Support Specialist
14 years 2 weeks ago #22940 by alzander
Replied by alzander on topic Truncate name
Feel free to delete my account on there and I can test. The code above is simple enough, but if I made some mistake, it could prevent users from registering. Better to happen to me than to others :D

Alex
The topic has been locked.
Active Subscriptions:

None
14 years 2 weeks ago #22941 by sbouloc
Replied by sbouloc on topic Truncate name
your account is deleted. Feel free to signin
The topic has been locked.
Support Specialist
14 years 2 weeks ago #22943 by alzander
Replied by alzander on topic Truncate name
Aweomse:

Bonjour, Alex S.

Looks like it's working. Definitely monitor how it goes, but hopefully you're setup now. If you need anything else, just let us know.

Finally, if you haven't already, please consider leaving a rating and review on the Joomla Extension Directory for JFBConnect, or our support. It's certainly not required, but very appreciated!
extensions.joomla.org/extensions/social-...ook-integration/7215

Thanks, and good luck!
Alex
The topic has been locked.