News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

GUEST posts: Deleting them all?

Started by Nodaz, August 31, 2015, 02:39:42 PM

Previous topic - Next topic

Nodaz

So somehow, the permission on my site got changed to allow guest to start new topics.
Needless to say i have a load of new post across the forum.  Other than manual deleting them is there a fairly simple way to locate and mass delete and post by a user "guest"

Kindred

not really...   but, if you have selected the option to view moderation options as checkboxes, you an select bunches of topics to be deleted at once.
Сл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."

Antechinus

SQL query should do it easily enough. Anyone know how to write it?

Illori

Quote from: Antechinus on August 31, 2015, 07:29:57 PM
SQL query should do it easily enough. Anyone know how to write it?

it might clean up the posts but it would not help to clean up and update the stats on the forum.

Antechinus


Kindred

Deleting posts directly in the database is a BAD process and is not encouraged. There are a bunch of things touched by posts that won't be fixed with the recount button as well
Сл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."

frakster

Would it be possible to make a 'dumper account' then transfer all posts from user Guest - > Dumper account username? Then just hose the dumper account.

I've never tried transferring from guests, just a shot in the dark here.

Antechinus

That's not a bad idea. It should work, unless I'm missing something.

Illori

Quote from: Antechinus on September 01, 2015, 02:52:45 AM
That's not a bad idea. It should work, unless I'm missing something.

i believe there is a bug in that function, it can be tried but i dont think it will delete the topics/messages as they are not 100% assigned to the new user.

Steve

Hasn't this very thing been suggested by the support team a number of times when someone deletes one or more members but forgets to delete their posts? Or is this not the same essential scenario?
DO NOT pm me for support!

Illori

Quote from: Steve on September 01, 2015, 08:40:01 AM
Hasn't this very thing been suggested by the support team a number of times when someone deletes one or more members but forgets to delete their posts? Or is this not the same essential scenario?

similar but i do believe there have been cases where it has failed to work correctly.

margarett

http://www.simplemachines.org/community/index.php?topic=435253.msg3055258#msg3055258

AFAIK this was fixed in 2.1 and if it wasn't fixed in 2.0, it should (but I think it was...)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Jade Elizabeth

I've deleted thousands of guest posts in phpmyadmin and never once has it caused anything to explode or error. They aren't connected to members so it's not like there's a tonne of crap that comes with them, and if you're really worried about stats it's really not that big a deal. I mean what stat is going to be uncleaned? And who cares because the stats are still valid, it's just the proof is gone ha ha.

If you want to do it the long way then use a phpmyadmin query to select the message id of all the messages from member id 0, then put ?msg=blah in your url for each one and you can delete them manually, but talk about doing things the hard way. I don't see how this is going to update all those stats and make anything cleaner lol.

Actually, even better. Make your dumper account then run a find and replace in phpmyadmin to replace member id 0 for posts and topics with this dumper accounts id, then repair all errors thingie in admin and delete the account.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Kindred

Jade,

Messages are also connected to the topics table (and to a few others, I believe)

just because you have done something without NOTICING an issue does not mean that it is a good idea - and deleting messages directly in the database is NOT a good idea.
Сл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."

Jade Elizabeth

But if you're doing it for both topics and messages you should be covered?
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Kindred

IIRC, there are one or two additional tables which are touched by the delete messages cleanup routines.
Сл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."

shawnb61

In principle, I agree with Kindred.

But if you gotta...   

Just quickly scanning the DB and looking for id_msg (or similar), there appear to be connections in many tables:
smf_attachments
smf_log_topics
smf_log_mark_read
smf_digest
smf_log_reported
smf_log_search_messages
smf_log_search_results
smf_topics   (things like first & last)

Based on the above, there are a bunch of things you'd need to do at a minimum...

(1-4) I bet existing maintenance would fix most:
  -  find & repair errors
  -  recount totals & stats
  -  attachment file cleanup
  -  "mark read for inactive users" script found in server performance area

(5) I'm also pretty sure you'd need to delete your search index & rebuild it. 

(6) Your notification mailers might be ugly & point to missing messages???   Maybe force those to execute just before your delete 'em. 

(7) Clear out your moderation log or it may point to dead messages.


If you absolutely must do this, test your script first in a freshly restored test environment.  And test it a LOT...

And let us know how it goes!   ;D

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

shawnb61

You should also look carefully at any features/tables added by your mods.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Antechinus

Quote from: Jade Elizabeth on September 01, 2015, 10:38:00 PMActually, even better. Make your dumper account then run a find and replace in phpmyadmin to replace member id 0 for posts and topics with this dumper accounts id, then repair all errors thingie in admin and delete the account.

Ok, just for the sake of discussion, what would be wrong with this approach? You're not deleting anything directly in the db. You're just changing a member id in the db, then using the standard admin gui for any deletions. Seems like this should cover all bases.

Kindred

yeah....   that would probably work...  don't forget to check the topics table as well
Сл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."

Advertisement: