Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: User2 on January 02, 2022, 02:10:05 PM

Title: Change the user's name and then delete it.
Post by: User2 on January 02, 2022, 02:10:05 PM
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?
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 02, 2022, 02:39:44 PM
By visitors do you mean guests or forum members?
Title: Re: Change the user's name and then delete it.
Post by: Kindred on January 02, 2022, 02:49:24 PM
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?
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 01:34:37 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 01:37:17 AM
I change both login name and display name.
Title: Re: Change the user's name and then delete it.
Post by: Doug Heffernan on January 03, 2022, 06:30:02 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 06:34:20 AM
I do not know what "sql query btw" is. I'm just a user, not a programmer.
Title: Re: Change the user's name and then delete it.
Post by: Doug Heffernan on January 03, 2022, 07:19:21 AM
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?
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 07:24:23 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 03, 2022, 07:47:17 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 07:53:14 AM
There is a remote user on my forum who is currently displaying the name kristina.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 03, 2022, 08:03:21 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 08:16:29 AM
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?
Title: Re: Change the user's name and then delete it.
Post by: Doug Heffernan on January 03, 2022, 08:41:04 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 08:46:59 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 03, 2022, 10:36:46 AM
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.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 10:54:19 AM
Yes, such characters can be: & "<>. How to make a request in these cases?
Title: Re: Change the user's name and then delete it.
Post by: Kindred on January 03, 2022, 10:55:52 AM
look up HTML entities

https://dev.w3.org/html5/html-author/charref
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 11:04:43 AM
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?
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 03, 2022, 11:18:36 AM
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)
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 03, 2022, 11:35:59 AM
I forbade users to change the display name on my forum. So for my forum, special characters don't matter.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 03, 2022, 12:38:52 PM
Well, you could have mentioned that beforehand...
Title: Re: Change the user's name and then delete it.
Post by: Doug Heffernan on January 03, 2022, 01:07:12 PM
Quote from: Arantor on January 03, 2022, 12:38:52 PMWell, you could have mentioned that beforehand...

Lol :D
Title: Re: Change the user's name and then delete it.
Post by: efk on January 03, 2022, 05:35:16 PM
After over a decade on SMF forums, for this specific situation I could not think of a single reason why would anyone delete multiple users like that. Before everything else, to do this thing manually for each user administrator need to invest time on each individual user. There are some valid situations where deletion could be done, but...

Please could you tell me the reason why do you delete users like that? Except deletion after 1 year of inactivity, what benefits you and your forum have from your actions?
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 03, 2022, 06:37:16 PM
I get the feeling the OP has his reasons and declines sharing them, as is his right. Just a feeling though.

Quote from: Participant on January 03, 2022, 01:34:37 AMQuote:
The biggest question is WHY do you delete users' accounts?

Because that's what I want.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 04, 2022, 01:18:48 AM
It doesn't matter what I'm doing it for. There is a bug in SMF, and this bug probably needs to be fixed. After all, there is a user deletion in the SMF functionality: I delete users through the forum, and not using add-ons or SQL.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 04, 2022, 01:21:59 AM
Quote from: Participant on January 04, 2022, 01:18:48 AMIt doesn't matter what I'm doing it for. There is a bug in SMF, and this bug probably needs to be fixed.
I don't see the bug.
As Admin you can change any users username and display name as you want.
You can delete any user account you want.
Leaving posts in place, leaves the usernames of deleted members in place.
Which part is the bug?
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 04, 2022, 01:28:59 AM
The display name changes after the user is deleted.
For example, the user displayed "Kristina" in the topic, and "Vomit" will be displayed. If a user has registered with the nickname "Vomit", then after deleting this user, this nickname will appear in the topic.

This is written in the first message.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 04, 2022, 01:35:27 AM
Still, it's not necessarily a bug.
It just doesn't retain the display name as you expect,
instead it retains the username, which is usually a constant that doesn't change.

If it used display name, one of two things would have to happen.
1) Every post would need to save the current display name, meaning you would end up with messages using multiple display names should the user ever change their display name.
2) In the even of account deletion, every post they have ever made would need to be updated in the database to keep the current display name.
Neither of these is necessarily something you want.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 04, 2022, 01:38:40 AM
I change both login name and display name on my forum.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 04, 2022, 01:44:38 AM
Yes, I understand that - But the point I was trying to make is that the posts in the database include user info, just so that the post can still be displayed after the associated user account is deleted, and in order to make this both efficient and logical, the retained user info includes the username which usually does not change after registration.

Deleting the user, does practically nothing to the posts anymore. If you want to change the username displayed, you either need to reattribute the posts to another account, or do the change yourself through the database as explained earlier. 
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 04, 2022, 06:26:00 AM
In other words, the software is working as designed and intended.
Title: Re: Change the user's name and then delete it.
Post by: Kindred on January 04, 2022, 09:45:01 AM
Quote from: Participant on January 04, 2022, 01:18:48 AMIt doesn't matter what I'm doing it for. There is a bug in SMF, and this bug probably needs to be fixed. After all, there is a user deletion in the SMF functionality: I delete users through the forum, and not using add-ons or SQL.

Actually, it *DOES* matter, quite often, since users with the sort of attitude that you are showing assume that they know the "only" way to get to the end goal -- and they are almost always wrong.

but anyway -- as has already been said: this is not a bug.  The software is performing EXACTLY as designed and as intended...   It might not fit YOUR desires, but we are designing the software for the majority use, not the individual exception.

(and, on a personal note, I would be really annoyed if the forums that I joined deleted my account after only a year. There are many forums that I participate in where I only check once a year or less, depending on what the forum subject matter is.)
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 04, 2022, 02:54:58 PM
@Kindred obviously you're doing it wrong and you shouldn't question it. Questioning it is rude, remember?
Title: Re: Change the user's name and then delete it.
Post by: Kindred on January 04, 2022, 02:56:27 PM
@Arantor   ayup... hence my title! :D
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 07, 2022, 08:38:03 PM
As the OP has been here since the last post I'm going to assume (yea, I know) that the issue has been answered. Marking solved.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 07, 2022, 10:43:31 PM
No, the topic is not solved. The forum does not work correctly - after deleting the user, the original login name is returned, about which the forum administrator no longer knows.

The proposed solution is inconvenient and may be regarded as temporary.

This is my opinion. And you with your opinion. Your logic is incomprehensible to me.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 08, 2022, 02:02:12 AM
You do have a solution, you just don't seem to agree with how SMF works.
If you want to change how SMF works, that is a different question completely.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 08, 2022, 08:16:33 AM
OK, so I've sat on the sidelines about this for a while to collect my thoughts. Firstly it's absolutely not a bug - speaking as someone who has been on the dev team, this is very much intentional on the part of the development team to behave the way it does. The rationale is long, complicated and orthagonal to the OP's use case, but it is not a bug as far as I'm concerned and I'd be concerned if it were deemed necessary to change in the 2.0 lifecycle. I don't even think I'd want it to be changed in the 2.1 lifecycle.

That said, there is absolutely a use case for the OP's requirements. The team view that 'the user is wrong' is in this case *incorrect*. It would be nice to understand the OP's rationale, to support whether the behaviour should be changed in future or made configurable (which is why people like me ask such questions normally, despite how many people vocally suggest that all user requests are valid and should just be satisfied upon request... this is not true, it has never been true and the original SMF founders absolutely said no to requests on many occasions)

But anyway. The OP has a valid request - I'd still love to know the reasons for it, but it does come up from time to time. So without further ado, let's help the OP to get what they need.

Edit Sources/Subs-Members.php

Code (find) Select
// Make these peoples' posts guest posts.
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET id_member = {int:guest_id}, poster_email = {string:blank_email}
WHERE id_member IN ({array_int:users})',
array(
'guest_id' => 0,
'blank_email' => '',
'users' => $users,
)
);

Code (BEFORE that, add this) Select
// Reset the names on these posts.
foreach ($user_log_details as $user)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET poster_name = {string:poster_name}
WHERE id_member = {int:id_member}',
array(
'id_member' => $user[0],
'poster_name' => $user[1],
)
);
}

Then before it resets all the ids to 0 (and makes them guest posts) it will also reset the name. For technical reasons the two can't be done in the same step.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 08, 2022, 08:24:33 AM
To be fair, I do not believe anyone said the OP is wrong to want this, but the original question was "Is this how it should be or is it a bug?"

That being said, thank you for sharing a solution for the OP. I can appreciate that.
Title: Re: Change the user's name and then delete it.
Post by: Doug Heffernan on January 08, 2022, 08:26:44 AM
Quote from: Arantor on January 08, 2022, 08:16:33 AMThe rationale is long, complicated and orthagonal

What does orthagonal mean? Or did you mean to say orthogonal instead?
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 08, 2022, 08:29:00 AM
The argument 'this is not a bug, this is by design' is implicitly asserting the design is correct and challenging the design is the wrong thing to do.

@Doug Heffernan, well, the word is pronounced in my accent with an a, and I forgot that it's not *spelled* with an a. In any case, the meaning should be clear: the reason why it is so is at a very distinctly different angle to the OP's use case.
Title: Re: Change the user's name and then delete it.
Post by: Doug Heffernan on January 08, 2022, 08:41:18 AM
Quote from: Arantor on January 08, 2022, 08:29:00 AM@Doug Heffernan, well, the word is pronounced in my accent with an a, and I forgot that it's not *spelled* with an a. In any case, the meaning should be clear: the reason why it is so is at a very distinctly different angle to the OP's use case.

Well, the meaning was clear to me as that word is the same in my mother tongue as well. But since english is not my mother tongue, I thought that maybe it meant something else in english and figured I should ask.

Title: Re: Change the user's name and then delete it.
Post by: User2 on January 10, 2022, 11:28:45 PM
Can I change the original login name (which the user specifies during registration) using SQL?
I change login name not only once a year, but also once a week.
Otherwise, I change the login name once a week, and next year, when I delete the user, the login name that the user used during registration will return.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 10, 2022, 11:39:28 PM
Quote from: Participant on January 10, 2022, 11:28:45 PMCan I change the original login name (which the user specifies during registration) using SQL?
Otherwise, I change the login name once a week, and next year, when I delete the user, the login name that the user used during registration will return.
What? Seriously I'm not following and would very much like to understand what you are trying to achieve.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 11, 2022, 03:13:37 AM
If you change the login name, the user won't be able to login until they reset their password.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 11, 2022, 03:55:06 AM
Arantor Quote:
If you change the login name, the user won't be able to login until they reset their password.

Yes, I know that. What is the problem? The user will receive an email with a new password. What problem do you see in this? Why are you telling me about this?


Aleksi "Lex" Kilpinen, I am changing user names so that there is no personal information on my forum. The user can use as a user name, for example, a surname or other personal information. I want my forum to not have any personal information about users in explicit or disguised form.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 11, 2022, 04:01:03 AM
Alright, I understand the goal. Thank you for explaining. That's going to be tricky though, in many ways. Depending on the jurisdiction, PII is generally any data that could potentially identify a specific individual. This includes the email address, IP address, hostname, usernames, displaynames, message contents...
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 11, 2022, 04:08:16 AM
Aleksi "Lex" Kilpinen, In addition, users can give a name in the form of advertising, in the form of bad words (vampire).
I will fix it all, and then a year later, after I delete users, all these original names will appear on my forum.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 11, 2022, 04:10:37 AM
Arantor, in this post, you provided the code: https://www.simplemachines.org/community/index.php?msg=4107089. In which cases will this code start working? When will I do what, where to click?
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 11, 2022, 06:12:30 AM
Quote from: Participant on January 11, 2022, 03:55:06 AMArantor Quote:
If you change the login name, the user won't be able to login until they reset their password.

Yes, I know that. What is the problem? The user will receive an email with a new password. What problem do you see in this? Why are you telling me about this?


If you do it with SQL they won't get a notification. It'll just not work unless you manually tell them.

To answer your last point, it does exactly what you asked for: when you delete a user, it will fix the display name in every post to be what you last changed it to.

I was trying to help you not confuse your users, but like everything else in this thread it feels like a waste of time and energy trying to help you. Have fun.
Title: Re: Change the user's name and then delete it.
Post by: @rjen on January 11, 2022, 01:02:23 PM
Quote from: Participant on January 11, 2022, 04:10:37 AMArantor, in this post, you provided the code: https://www.simplemachines.org/community/index.php?msg=4107089. In which cases will this code start working? When will I do what, where to click?

If you make those changes you are effectively changing the standard functionality when deleting a user: it will adopt te display name exactly like you want...
Title: Re: Change the user's name and then delete it.
Post by: efk on January 11, 2022, 05:55:49 PM
Quote from: Participant on January 11, 2022, 04:08:16 AMAleksi "Lex" Kilpinen, In addition, users can give a name in the form of advertising, in the form of bad words (vampire).
I will fix it all, and then a year later, after I delete users, all these original names will appear on my forum.
This is exactly the reason why you are the only, or like in Matrix movie, you are the ONE who is trying to make from SMF what SMF obviously is not. As everyone already told you before "do not delete your users", so far all your points about deletion are wrong and bad, and idea is bad. The best thing you can do is to go to the member profile:
1. and replace email of target user with anything else (email exist to manipulate with account, without it and without password, user will not be able to restore his account anymore.)
2. change his password
3. set displayed name
4. ban user and set his post count to 0
5. do not delete user, you can optionally do deletion of his posts

Every time you go with deletion you will go deeper in problems, and I believe you won't help yourself later, nor will anyone fix your mess.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 11, 2022, 11:11:31 PM
efk, SMF has a built-in function for deleting users and this function does not work correctly.
I'm not inventing anything, but only trying to use the built-in SMF function, which works unpredictably for the administrator.

A request to the participants: do not write your wishes, otherwise you make the topic unreadable, because a lot of messages appear in it and then it will be difficult to solve this problem.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 11, 2022, 11:37:37 PM
Quote from: Participant on January 11, 2022, 11:11:31 PMefk, SMF has a built-in function for deleting users and this function does not work correctly.
Yes it does. It works as it is meant to work, even though you do not agree with that.
Quote from: Participant on January 11, 2022, 11:11:31 PMI'm not inventing anything, but only trying to use the built-in SMF function, which works unpredictably for the administrator.
No, it doesn't. Unpredictable means you don't know and can't guess what will happen. You already know exactly what happens, and it works the same way every time, so it is quite predictable.
Quote from: Participant on January 11, 2022, 11:11:31 PMA request to the participants: do not write your wishes, otherwise you make the topic unreadable, because a lot of messages appear in it and then it will be difficult to solve this problem.
Did you try the solution arantor offered?
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 04:38:53 AM
Aleksi "Lex" Kilpinen, I already know about this problem, but the other administrator does not know about it yet.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 04:41:16 AM
Arantor, after installing the next patch (2.0.20), the file Subs-Members.php can it change? I will need to make changes to the file again Subs-Members.php ?
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 12, 2022, 05:03:24 AM
It may change in some patch in the future, but I would say it is fairly unlikely to change in a way that would interfere with this edit.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 05:21:32 AM
To which places of the file Subs-Members.php insert these codes:
// Make these people' posts guest posts
// Reset the names on these posts
Title: Re: Change the user's name and then delete it.
Post by: Kindred on January 12, 2022, 08:46:29 AM
Quote from: Arantor on January 08, 2022, 08:16:33 AMEdit Sources/Subs-Members.php

Code (find) Select
// Make these peoples' posts guest posts.
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET id_member = {int:guest_id}, poster_email = {string:blank_email}
WHERE id_member IN ({array_int:users})',
array(
'guest_id' => 0,
'blank_email' => '',
'users' => $users,
)
);

Code (BEFORE that, add this) Select
// Reset the names on these posts.
foreach ($user_log_details as $user)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}messages
SET poster_name = {string:poster_name}
WHERE id_member = {int:id_member}',
array(
'id_member' => $user[0],
'poster_name' => $user[1],
)
);
}


Arantor told you what to find and what to add and where to add it in the original post...
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 08:53:59 AM
I'm just a user, I don't know where to make changes. I have seen the codes, but I do not know where to insert them.
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 12, 2022, 10:48:08 AM
You're not the admin or co-admin?
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 12, 2022, 11:24:26 AM
If you have access to the forum's files, then you can find the file Sources/Subs-Members.php

In that file you would need to find this location
Code (find) Select
    // Make these peoples' posts guest posts.
    $smcFunc['db_query']('', '
        UPDATE {db_prefix}messages
        SET id_member = {int:guest_id}, poster_email = {string:blank_email}
        WHERE id_member IN ({array_int:users})',
        array(
            'guest_id' => 0,
            'blank_email' => '',
            'users' => $users,
        )
    );

And add this immediately before it
Code ("BEFORE that, add this") Select
    // Reset the names on these posts.
    foreach ($user_log_details as $user)
    {
        $smcFunc['db_query']('', '
            UPDATE {db_prefix}messages
            SET poster_name = {string:poster_name}
            WHERE id_member = {int:id_member}',
            array(
                'id_member' => $user[0],
                'poster_name' => $user[1],
            )
        );
    }

Before making any changes, it is always a perfect idea to make a backup copy of the file - just in case.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 12:19:18 PM
Steve, I am an admin user, not an admin programmer. I use the user interface to work with the forum.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 12:34:55 PM
Arantor, yes, your code works at first glance. I will use it until the SMF developers make changes to the forum.
Title: Re: Change the user's name and then delete it.
Post by: Kindred on January 12, 2022, 01:04:34 PM
The SMF developers are ***NOT*** going to make this change to the core.

I'll repeat this one more time, since you don't quite get it.

The way the system currently works IS NOT A BUG.
The way the system currently works is FUNCTIONING AS DESIGNED.

The way *YOU* would like it to work is counter to our design, based on your opinion, and will not ever be part of the core product.

Basically, you are trying to do something that is not recommended, in a way which is counter to how 99.999999999% admins manage their sites (I have never heard of a site in which the accounts are deleted as you are doing -- and if I ever joined such a site, I would be happy to leave if an admin did what you are doing).
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 01:08:12 PM
When I come to the forum, I don't join anyone. I come to the forum to ask a question and get an answer. Why do you go to the forums - I do not know. Are you confusing forums and social networks?
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 12, 2022, 01:32:50 PM
Never is a strong word, but I agree this is highly unlikely to change in the near future. Certainly not likely to ever change for 2.0

Quote from: Participant on January 12, 2022, 01:08:12 PMWhen I come to the forum, I don't join anyone. I come to the forum to ask a question and get an answer. Why do you go to the forums - I do not know. Are you confusing forums and social networks?
Somewhat ironically, I think the complete opposite is more common - People use social networks and such to seek out simply fast answers, and forums are often more natural platforms for discussions aimed at a more limited but somewhat more invested audiences.

For example, you have been a member on this forum since 2015 and have posted over a 100 times in that time .
If we deleted users after a year, you would have had to re-register at least 4 times already.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 12, 2022, 02:46:44 PM
It's not difficult for me to register anywhere if I need an answer to a question. 1 time a year is not often.
Title: Re: Change the user's name and then delete it.
Post by: a10 on January 12, 2022, 04:58:24 PM
So, the breadtoaster I've chosen to use won't play mp3 files. I'll simply contact Philips and expect they immediately, and free of charge, implant that capability.


Hint >
https://www.simplemachines.org/community/index.php?board=50.0
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 13, 2022, 12:45:47 AM
Quote from: Participant on January 12, 2022, 02:46:44 PMIt's not difficult for me to register anywhere if I need an answer to a question. 1 time a year is not often.
I can guarantee that this works to prevent any sort of long time regular userbase from ever forming, and will also work well to prevent anyone else from volunteering to offer the answers, to what the users you do get are seeking. This will also mean you need to do a lot of manual work, that offers no benefit to you or the users.

Better approach would be to let your users request deletion if they want to, and only act then.
Lot less work, lot less worries.
Title: Re: Change the user's name and then delete it.
Post by: efk on January 13, 2022, 03:27:16 PM
Lex, we all might be wrong. What if he is running a black market and so his site users does deals via tickets and after some time of inactivity Admin wants to give them back promised privacy, to his user, or just after the job was done. This makes sense  ;)
If you join website and website is promising you that after whatever business you have, after deal is completed, for both sides is better to not keep information.
I as admin can see this as possible to have deals like that and its definitely a good thing to have such an option if circumstances are similar to example which I provided in 1st sentence of this post.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 13, 2022, 11:12:22 PM
Then you would definitely remove the posts as well, and the usernames would be the least of your worries as there would be IP addresses and e-mail addresses to deal with as well.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 14, 2022, 01:16:41 AM
You're getting off topic. This topic does not discuss whether to delete users or not. This topic discusses the use of tools built into the forum that work unpredictably for the administrator.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 14, 2022, 04:34:22 AM
The solution proposed by Arantor is 100% suitable for me. SMF developers need to implement this solution in the next patch. And then the topic can be considered closed.
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 14, 2022, 04:52:40 AM
Will not happen. Period.
And since you have confirmed the solution offered is working for you, we can just let this issue rest now.
Topic is marked solved, and if need be will be locked as well.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 25, 2022, 02:03:37 AM
Aleksey "Lex" Kilpinen, you write that this is what is intended: after deleting a user, in the themes of this user, his display name is replaced with the original login name. Why is this invented - why should the display name be replaced with the original login name, what is the logic in this?
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 25, 2022, 02:11:16 AM
I did already try to explain some of it to you earlier,
and the why really isn't even that important right now, since this is not likely to change for 2.0.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 25, 2022, 02:15:58 AM
Can you give a link to the answer in which you explain this? I didn't see any explanations, you just reported the fact that it was intended that way. So I have a question: what is the logic of such a tool?

I'm not asking you to make changes, I realized that it's not important to you. The question just appeared: what is the logic?
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 25, 2022, 04:03:28 AM
Because of the underlying functionality that copes with guest posts being promoted to regular account posts, this is used to be able to later differentiate posts made by the original guest posting and those made under a real account.

I don't expect you to understand, though, that other people have different use cases to yours, or that this is a courtesy giving you an explanation.
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 25, 2022, 07:26:14 AM
You have your answer and now the reason it's the way it is. If the discussion still continues, I'll lock this.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 25, 2022, 01:53:37 PM
Arantor, As an administrator, what gives me such functionality? Can you give an example when such functionality is needed?
After all, I am an administrator, I use the forum and should probably understand some things. Or is this a thing not for administrators, but for forum developers?
Title: Re: Change the user's name and then delete it.
Post by: Aleksi "Lex" Kilpinen on January 25, 2022, 02:04:49 PM
Reattribute User Posts. It's built in functionality in SMF.
Available to you as administrator, within the admin panel.



Title: Re: Change the user's name and then delete it.
Post by: efk on January 25, 2022, 04:51:31 PM
Quote from: Arantor on January 25, 2022, 04:03:28 AMBecause of the underlying functionality that copes with guest posts being promoted to regular account posts, this is used to be able to later differentiate posts made by the original guest posting and those made under a real account.

I don't expect you to understand, though, that other people have different use cases to yours, or that this is a courtesy giving you an explanation.
Wait, guests? Since I never allowed guests to post on any of my forums, could anyone give more details about this? This sounds as unexplored part of SMF. Does guests use *names while posting or just post as random guest? Is their IP recorded?
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 25, 2022, 05:14:39 PM
Quote from: efk on January 25, 2022, 04:51:31 PMSince I never allowed guests to post on any of my forums, could anyone give more details about this? This sounds as unexplored part of SMF. Does guests use *names while posting or just post as random guest? Is their IP recorded?

Firstly it only really matters if you allow guest posting - and, frankly, who does except me? (Yes, I have a live forum with guest posts. I get surprisingly little spam.) Remember SMF has history and back in 2004 guest posting was less dramatic.

When a guest posts, they are invited to enter a name and an email, and their IP is recorded just like it is for anyone else posting. The name and email are verified against the ban lists as you'd expect and the name will be shown to anyone who happens to see the post.

Email is only viable to the usual folks with relevant permissions, of course.

But since it's possible to escalate from guest posts to full accounts as discussed, you might need to be able to keep the two separate from a management point of view even if the data is not usually exposed.
Title: Re: Change the user's name and then delete it.
Post by: User2 on January 25, 2022, 10:45:13 PM
efk, create your own topic and discuss your questions there. You complicate the discussion of this topic: the more messages in the topic, the more difficult it is to understand it later - not everyone wants to read dozens of posts.
Title: Re: Change the user's name and then delete it.
Post by: SpacePhoenix on January 26, 2022, 02:22:14 AM
Without flicking through the whole thread, I don't know if anyone has brought up the issue with a username being in posts where a post by the user in question has been quoted in a post
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 26, 2022, 05:04:57 AM
Quote from: SpacePhoenix on January 26, 2022, 02:22:14 AMWithout flicking through the whole thread, I don't know if anyone has brought up the issue with a username being in posts where a post by the user in question has been quoted in a post

No, that's not been bought up and is infinitely more complex to address given that free form addressing can be used alongside the default quoting, e.g.

Quote from: ArantorBored of this debate now.
Title: Re: Change the user's name and then delete it.
Post by: Steve on January 26, 2022, 07:06:02 AM
Quote from: Participant on January 25, 2022, 10:45:13 PMefk, create your own topic and discuss your questions there. You complicate the discussion of this topic: the more messages in the topic, the more difficult it is to understand it later - not everyone wants to read dozens of posts.
It was a valid question to ask here so chill.
Title: Re: Change the user's name and then delete it.
Post by: efk on January 26, 2022, 12:06:21 PM
Quote from: Participant on January 25, 2022, 10:45:13 PMefk, create your own topic and discuss your questions there. You complicate the discussion of this topic: the more messages in the topic, the more difficult it is to understand it later - not everyone wants to read dozens of posts.
Dude its relevant subject to discuss. Being a topic starter doesn't means that you are the boss of topic nor topic belongs to you, everyone is allowed to participate if discussion can give more valued info. And You should be happy and grateful because you are getting more and more relevant info while this topic was supposed to be locked few days ago. Many of us noticed that this is unexplored part of SMF so You can find a lot of additional info which you can use for better control of what you can do with this software.

Such topics with rare info should be somehow tagged/listed as important.
I am very grateful to see old people from SMF posting and literally provoking some of us, so we are in mood MUST TO GO with testing something new.

Quote from: Arantor on January 25, 2022, 05:14:39 PMWhen a guest posts, they are invited to enter a name and an email, and their IP is recorded just like it is for anyone else posting. The name and email are verified against the ban lists as you'd expect and the name will be shown to anyone who happens to see the post.
Email is only viable to the usual folks with relevant permissions, of course.
But since it's possible to escalate from guest posts to full accounts as discussed, you might need to be able to keep the two separate from a management point of view even if the data is not usually exposed.
So guests are acting similar like newly registered users, they can register later as their info already reserves account with that name, and I guess increment number goes as for the next member the first time guest does his post and gets reserved ID for future registration.
Title: Re: Change the user's name and then delete it.
Post by: Arantor on January 26, 2022, 12:38:56 PM
Quote from: efk on January 26, 2022, 12:06:21 PMSo guests are acting similar like newly registered users, they can register later as their info already reserves account with that name, and I guess increment number goes as for the next member the first time guest does his post and gets reserved ID for future registration.

Not exactly. The posts are *real* posts. They're not hidden away or anything (unless you have post moderation on for them), but will appear completely normally as if a member had made them.

Literally the only difference is that the post is from 'member id 0' with the name/email/IP embedded in the post just like it would normally anyway.

If you then decide to attribute posts, SMF will let you take these posts and attach them to an account if an account later exists - but the username/email is left originally just in case this matters to you (and/or in the case of integrations to external systems, e.g. Joomla which is also part of the rationale)