MyBB Community Forums

Full Version: Rename all usernames
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

first post, please apologize me if I do not approach the forum in the good way. Just let me know, I'll try to fix Smile

So, the problem:

I am maintaining a forum where all the users (about 400) were created from users of a related website, with username = "name + surname".
Now, for privacy reasons I'd like to move the username to something like "name + initial of surname".
Is there a way to programatically rename all users?

I have seen a plugin to allow a display name different from the user name, but I am not sure this is what I want to do; I'd rather prefer really changing the usernames.

Thanks in advance for your help.

Francesco
I'm not great with making more complex SQL queries but if all usernames are in that format then yes a query to trim down all usernames to the first character after the space would be possible.
You would need some sort of delimiter to split the names by. So if it was "first name" + character + "surname" you can split based on the character and change the surname. If the names were just grouped together like "JaneDoe" you could maybe split on the second capital letter in the string, but that wouldn't work if anyone have a double-capital letter in their name anywhere. So what exactly does each name look like in the database?
Thanks for the answers.

Users are mainly french names, meaning almost all single name and single surname.

So, the idea is just to run an SQL query on the database to update the names mybb_users table?
There are no constraints on other tables? 

Also, there is no feature in myBB to allow that kind of change from a GUI?
I'm not good with complex sql queries but I can make a php tool to do that. How many characters the surname must have? Should it finish with a dot?
The SQL query is not a problem.
The questions are more intended to understand what is the right/usual way to do this kind of change, because I am quite new to myBB.
You can edit users one by one from ACP or you have to edit all the fields in the database.
Be careful with a bulk rename, as you may get duplicates
(2017-06-25, 11:52 AM)pintun Wrote: [ -> ]The SQL query is not a problem.
The questions are more intended to understand what is the right/usual way to do this kind of change, because I am quite new to myBB.

The right way to do this would be to either manually go and edit every user in the ACP one by one, or to force all users to change their usernames on next login (might need a plugin for that?) and set rules for their new names. Any SQL query you could make up will rely on a delimiter, as I said before, if you're going to maintain the names and just shorten the surname. Otherwise the only alternative I see would be rtrimming X amount of characters off each name arbitrarily, but this will obviously cause issues with possible duplicates or entire surnames being removed if they're short enough.
(2017-06-26, 05:11 PM)laie_techie Wrote: [ -> ]Be careful with a bulk rename, as you may get duplicates

I would export the username column and copy/paste into textmechanic tool to check for duplicate lines.