Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: kitz on March 16, 2016, 06:06:21 PM

Title: Change the name on posts for a deleted member account.
Post by: kitz on March 16, 2016, 06:06:21 PM
Hi I wonder if anyone can help please.   A member recently wished for all his account to be deleted and Ive done this.

However I now notice that all his posts of which there are a few thousand are still attributed to his old membername.  I was mistakenly under the impression that they would be attributed to 'guest' or something like 'anonymous'.

Looking in the database it would appear that his posts are attributed to id_member = 0.  With hindsight it would have perhaps been a good idea to change his username before deletion but its too late as I didnt realise it would still show his old member name..  so now I need to run some sort of query on the database.

Please be gentle with me here -  I never go into the SMF database because Im too scared of mucking something up...   but after scratching my head and realising that smf_members.member_name and smf_members. real_name have nothing to do with the smf_messages table and trying to work out what is going on.

Using id_member = 0 wont work because it appears there's some 'Anonymous' which probably date back to long ago SMF1 days...  and several hundred posts that arent his.



However would running something like the following work.    Would it affect anything else?

UPDATE `smf_messages`
SET  `smf_messages`.`poster_name` = "guest"
WHERE `smf_messages`.`poster_name` = "oldname"


Is there a chance anything could go wrong.  The forum is >10yrs old so the database is quite large and I really dont want to mess anything I shouldnt. 
Title: Re: Change the name on posts for a deleted member account.
Post by: JBlaze on March 16, 2016, 06:11:22 PM
Depending on how many posts your forum has, that query could take a long time to run and could bottleneck things for a bit. But to answer your question, yes that is the correct query to use, and no it won't harm anything.

Mind if I ask how many posts you have in your forum?
Title: Re: Change the name on posts for a deleted member account.
Post by: kitz on March 16, 2016, 06:16:10 PM
Hi JBlaze - thank you for the prompt reply

311871 Posts in 14299 Topics
Title: Re: Change the name on posts for a deleted member account.
Post by: JBlaze on March 16, 2016, 06:27:49 PM
Shouldn't be too much of a problem then. I strongly suggest making a database backup beforehand, and also placing your forum in maintenance mode while it runs.
Title: Re: Change the name on posts for a deleted member account.
Post by: kitz on March 16, 2016, 06:35:02 PM
OK - I shall do that.   Thank you vm for your help.
Title: Re: Change the name on posts for a deleted member account.
Post by: kitz on March 16, 2016, 08:26:51 PM
Worked perfectly.   Thank you