News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Disable display names + revert to usernames?

Started by StarredSkies, February 14, 2024, 06:51:13 PM

Previous topic - Next topic

StarredSkies

Hello! Is there a way to display display names and then revert them to their usernames? 'Allow users to edit their displayed name' does not do this.

Kindred

No.
It's a bad idea anyway.
You should always have a different login from your display name
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

StarredSkies

Quote from: StarredSkies on February 14, 2024, 06:51:13 PMHello! Is there a way to display display names and then revert them to their usernames? 'Allow users to edit their displayed name' does not do this.

Oop, typo. Should be 'disable display names.' Sorry!

Quote from: Kindred on February 14, 2024, 08:29:59 PMNo.
It's a bad idea anyway.
You should always have a different login from your display name

Any reason why it's a bad idea to disable display names? I would prefer to disable them/revert to usernames so I can do some work on a test forum.

Sir Osis of Liver

To answer your question:  Admin > Features and Options > Allow users to edit their displayed name.

You'd have to run a database query to replace member_name with real_name.
When in Emor, do as the Snamors.
                              - D. Lister

Kindred

Well, first, allow users to edit display name turned off will make all future display names = the username...  but not past ones

Second, it's better to have the display name and login to be different,  for security
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

Quote from: Kindred on February 14, 2024, 08:54:07 PMWell, first, allow users to edit display name turned off will make all future display names = the username...  but not past ones

Quote from: Sir Osis of Liver on February 14, 2024, 08:52:47 PMYou'd have to run a database query to replace member_name with real_name.

QuoteSecond, it's better to have the display name and login to be different,  for security
Not suggesting it's a good idea, just answering the question.  OP may have a valid reason for doing it, maybe for test purposes.
When in Emor, do as the Snamors.
                              - D. Lister

StarredSkies

Quote from: Sir Osis of Liver on February 14, 2024, 08:52:47 PMTo answer your question:  Admin > Features and Options > Allow users to edit their displayed name.

You'd have to run a database query to replace member_name with real_name.


Thank you! How would I phrase the query? I have a general idea, but I just want to make sure before I execute anything (even with a backup... less work lol).

Quote from: Kindred on February 14, 2024, 08:54:07 PMWell, first, allow users to edit display name turned off will make all future display names = the username...  but not past ones

Second, it's better to have the display name and login to be different,  for security

Gotcha. Like I said, this is only for testing, so it won't be something for users. :)

Sir Osis of Liver

This seems to work -

UPDATE `smf_members` SET member_name = real_name
When in Emor, do as the Snamors.
                              - D. Lister

Diego Andrés

Wouldn't it be real_name = member_name since username should be kept the same?

SMF Tricks - Free & Premium Responsive Themes for SMF.

Aleksi "Lex" Kilpinen

Quote from: StarredSkies on February 14, 2024, 08:39:05 PMAny reason why it's a bad idea to disable display names? I would prefer to disable them/revert to usernames so I can do some work on a test forum.
Simple, you only need username and password to login in, this change gives everyones usernames away so now you only need passwords. It weakens login security.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

StarredSkies

Quote from: Sir Osis of Liver on February 14, 2024, 09:45:58 PMThis seems to work -

UPDATE `smf_members` SET member_name = real_name

Quote from: Diego Andrés on February 14, 2024, 11:02:58 PMWouldn't it be real_name = member_name since username should be kept the same?

Thank you guys! Appreciate it. (Will wait on confirmation of Diego's question though.

Quote from: Aleksi "Lex" Kilpinen on February 14, 2024, 11:29:14 PMSimple, you only need username and password to login in, this change gives everyones usernames away so now you only need passwords. It weakens login security.

Definitely makes sense.

Sesquipedalian

This topic, containing both warnings and instructions, reminds me of this:

QuoteIt is not UNIX's job to stop you from shooting your foot. If you so choose to do so, then it is UNIX's job to deliver Mr. Bullet to Mr. Foot in the most efficient way it knows.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

Quote from: Diego Andrés on February 14, 2024, 11:02:58 PMWouldn't it be real_name = member_name since username should be kept the same?

No, real_name is username, member_name is display name, so you want to replace display with username.  The query makes both values username.

When in Emor, do as the Snamors.
                              - D. Lister

Arantor

No, member_name is the username, real_name is the display name.

As per LogInOut.php:

// Load the data up!
$request = $smcFunc['db_query']('', '
SELECT passwd, id_member, id_group, lngfile, is_activated, email_address, additional_groups, member_name, password_salt,
openid_uri, passwd_flood
FROM {db_prefix}members
WHERE ' . ($smcFunc['db_case_sensitive'] ? 'LOWER(member_name) = LOWER({string:user_name})' : 'member_name = {string:user_name}') . '
LIMIT 1',
array(
'user_name' => $smcFunc['db_case_sensitive'] ? strtolower($_POST['user']) : $_POST['user'],
)
);
Holder of controversial views, all of which my own.


Sir Osis of Liver

Really?  Doesn't make sense.  Will have a another look.
When in Emor, do as the Snamors.
                              - D. Lister

Arantor

That's literally from the piece of code where it gets the data to be checked during login. There is no higher authority than that.
Holder of controversial views, all of which my own.


Sir Osis of Liver

You're correct, of course, but the variables are poorly named.  real_name should be display_name, makes more sense.  So the query should be -

UPDATE `smf_members` SET real_name = member_name
When in Emor, do as the Snamors.
                              - D. Lister

Arantor

The choice of terminology dates back to *at least* YABB SE if not YABB itself, which would certainly have been in an era where people having a username and then using their actual real name for display purposes would have been quite common etiquette.
Holder of controversial views, all of which my own.


StarredSkies


Advertisement: