News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

Main Menu

Change the user's name and then delete it.

Started by User2, January 02, 2022, 02:10:05 PM

Previous topic - Next topic

User2

Hello.
On my forum, I delete visitors who have not been on the forum for more than a year.
Before I delete them, I want to change their names.
I change the names of visitors, then I look at the topic of this visitor, in the topic the name of the visitor has changed.
Then I delete the visitor, look at his topic, and the visitor's name remains the original one.
Is this how it should be or is it a bug?

Steve

By visitors do you mean guests or forum members?
My pet rock is not feeling well. I think it's stoned.

Kindred

That is because USERS have a login nane and a display name.

When you delete an account, thr messages get tagged to no user ID, but use the original posters login name, not the display name.

The biggest question is WHY do you delete users' accounts?
Сл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."

User2

Quote:
The biggest question is WHY do you delete users' accounts?

Because that's what I want.

Quote:
By visitors do you mean guests or forum members?

Forum members. There are no guests on my forum.

User2


Doug Heffernan

Quote from: Participant on January 03, 2022, 01:37:17 AMI change both login name and display name.

You can change the name of deleted users in posts by running a sql query btw.

User2

I do not know what "sql query btw" is. I'm just a user, not a programmer.

Doug Heffernan

Quote from: Participant on January 03, 2022, 06:34:20 AMI do not know what "sql query btw" is. I'm just a user, not a programmer.

It is very simple. All you have to do is copy the query, paste it to the SQL box in your phpmyadmin and then run it.

Now, how does the username of the deleted user appear in posts?

User2

Quote:
Now, how does the username of the deleted user appear in posts?

I didn't understand the question. Login name is just displayed.


Quote:
copy the query

I do not know where to get the request.

Arantor

He's asking you for an example username that's shown in the forum, so he can give you the query to fix it.

It works as a 'find/replace' but you need to know what to look for - the old username in this case.
Holder of controversial views, all of which my own.


User2

There is a remote user on my forum who is currently displaying the name kristina.

Arantor

UPDATE smf_messages SET poster_name = 'someone else' WHERE poster_name = 'kristina'
would be the obvious query to use here.

You'd change the 'someone else' to whatever you wanted to display instead of kristina. Care needs to be taken if you have names with ' in them but we'll deal with that if there are any.

Depending on when/how you installed SMF, you might find the prefix is not smf_ but something else, and you might need to change it to match, but we won't be able to tell you what.
Holder of controversial views, all of which my own.


User2

#12
Yes, there may be an apostrophe '.
I inserted the query, clicked Simulate Query, the message appeared: #1046 - Database not selected
Do I need to first go to the smf_messages database, and then go to the SQL section, insert your query there and run it?

Doug Heffernan

Quote from: Participant on January 03, 2022, 08:16:29 AMYes, there may be an apostrophe '.
I inserted the query, clicked Simulate Query, the message appeared: #1046 - Database not selected
Do I need to first go to the smf_messages database, and then go to the SQL section, insert your query there and run it?

smf_messages is not the database name, but the table name. Anyways, you will have to select the database where you have installed your smf forum, and then click the SQL box there. It is not necessary to open the smf_messages tables to run the query.

User2

Doug Heffernan, thank you, I understood you, yes, I did not choose the base at first.

What will the request look like if there is a ' in the username? On my forum, any characters can be in the username - there are no restrictions.

Arantor

The request will be different, something like:

UPDATE smf_messages SET poster_name = 'other name' WHERE poster_name = 'Mr O'Malley'
Note that it is a & then a # then 039 then ; for an apostrophe. You must also be careful to use the same replacement code if using an apostrophe in the other name.

Other characters that are special and complicated with other rules: & " < >

Also, any emoji if anyone has used those. These need special handling again but I'm not going to list all the possible combinations - if you have these, please let me know and I'll write the relevant queries, but there's too many to do otherwise.
Holder of controversial views, all of which my own.


User2

Yes, such characters can be: & "<>. How to make a request in these cases?

Kindred

Сл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."

User2

I've just done a test. I tried to register on my forum using these symbols: &" < >'. The forum did not allow me to register, writing that there are invalid characters in the username. So there will be no usernames with such symbols on my forum. So there is no need to complicate the request.

But it's strange that you wrote about these symbols. Did you not know that these characters are forbidden on SMF? Or are these characters allowed in some cases?

Arantor

Quote from: Participant on January 03, 2022, 11:04:43 AMDid you not know that these characters are forbidden on SMF?

Considering that I'm literally the person who rewrote the rules in SMF 2.0.6 about what was allowed in usernames, yes, I did know that.

However, there is the difference between username and display name and I was sure off the top of my head about the post code backfilling from the displayed name (rather than the username) and those are definitely allowed in display names.

But a quick look back at 2.0 (it's been a while) suggests that it will populate the username not the display name into the backfilled field so that's probably fine (and that's considering both the routes to which the name will be pulled with the variable shuffling done in both Post2() and createPost() about whether the person posting is a guest or not)
Holder of controversial views, all of which my own.


Advertisement: