News:

Join the Facebook Fan Page.

Main Menu

Bulk delete posts

Started by nizarala, January 12, 2015, 04:59:20 PM

Previous topic - Next topic

nizarala

I am new to this community, and I don't know much about programming. I searched for hours, but could not find an answer to my question in this forum. Maybe I am using the wrong keywords, so forgive me if this has already been answered somewhere else.

I have been running a forum for my undergraduate course since 2011. I only moderate it while the class is happening, and I never had any major problem with spam. This Fall, while I was not monitoring it, it was attacked by spammers. I deleted all the spam members and added more security for new members, so that I am not having any new spam. Now I want to delete the posts made by the spammers. How can I bulk delete them? One thing that may help: any post in the year of 2014 is a spam and can be automatically deleted, so any script that allowed me to simply delete all posts in 2014 would be immensely helpful.

Thank you!

Gwenwyfar

You can activate the "quickmod" feature on your profile settings, and set it to checkbox, then a checkbox will appear on the side of posts and topics to do anything in bulk with them.

Not sure this is just me not understanding how it works or if something broke the feature, but I never found how to use it on posts though, when I select multiple posts no button for "delete all of them" appears  ???

Deaks

If you go to Admin -> Maintenance -> Forum Maintenance -> Topics

You can delete topics that were created in whatever time frame, im guessing by what you said its only spam on your forum and few related posts?
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

nizarala

Thanks for the replies!

Fortytwo, like you I have the checkboxes, but when I click on them no "delete" button shows up. I can only find a "Remove" option she I click on an individual topic.

Runic, I go to that location, but I see no option to remove topics in a specific time frame. The only option I see is to remove topics that have no posts in the last X days. I cannot use this function. The forum has over a thousand legitimate posts from previous semesters. They have no new posts on them, but it is important to keep the archives. The students on each semester can benefit from the previous discussions.

Kindred

No, there is no option to bulk delete posts from a specific timeframe.

Th checkboxes are really the only way to bulk delete...
Сл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."

Gwenwyfar

For multiple topic moderating (including deleting) you will have the option to do that on the action select list in the bottom of the topic list.

The checkboxes on posts are what I don't know how works (if it works) :P

Sir Osis of Liver

You can do it with a MySQL query in phpmyadmin.



DELETE FROM smf_messages WHERE poster_time BETWEEN 1388534401 AND 1420070399



This will delete all messages posted between Jan 1, 2014 00:01 and Dec 31, 2014 23:59.  If they are all spam, shouldn't cause any crosslink problems.  BACKUP YOUR DATABASE BEFORE YOU TRY THIS!!!!!
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

nizarala

Thanks Fortytwo and Kindred, I got it!  It is not the most efficient way, but it beats doing it one by one.

Krash, this seems like it would completely solve my problem. Forgive my ignorance, but I have no idea how to go about running this. Could you perhaps walk me through the steps? Thank you!

Kindred

The thing is, deleting messages directly in the database like that leaves things misconnected and uncleaned-up...
Сл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."

Arantor

Quote from: Kindred on January 12, 2015, 10:39:45 PM
The thing is, deleting messages directly in the database like that leaves things misconnected and uncleaned-up...

...and even running the maintenance won't get them all either.
Holder of controversial views, all of which my own.

Sir Osis of Liver

You access phpmyadmin in your host cpanel, MySQL database section.  Do a backup by exporting the db to your local computer, then do it again, make sure both files are same size.  If your host has a db backup feature, do that as well.  Once you're sure you have a good backup, find the query button in phpmyadmin, copy the query into the box, and run it.  It will delete all 2014 posts from smf_messages table.

If your db is large, and you have a crappy host, backup may timeout before it's complete without throwing error.  Empty your error log before you start.  You can also export just the one table.  Am assuming you have a default db setup, and table prefix is smf_.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sir Osis of Liver

Quote from: Kindred on January 12, 2015, 10:39:45 PM
The thing is, deleting messages directly in the database like that leaves things misconnected and uncleaned-up...

Yes, but if they're all spam, shouldn't leave any loose ends.  OP has already deleted the members.  Can't think of any other way to do it.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Of course it will leave loose ends. At a bare minimum, the topics and boards tables will have broken relations.
Holder of controversial views, all of which my own.

Hj Ahmad Rasyid Hj Ismail

Will assigning all that posts to one created member and deleting this member after that, be easier?

Sir Osis of Liver

You mean like this?



UPDATE smf_messages SET id_member=#### WHERE poster_time BETWEEN 1388534401 AND 1420070399



#### is new member id.  Then you could delete the member and remove all posts.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

It still wouldn't fix all the broken relations.
Holder of controversial views, all of which my own.

Sir Osis of Liver

Well, is there a way to do it?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Yes, do ALL the interrelated tables manually. Or just... not do any of it manually in the first place and use things like quick moderation. SMF was never designed to do it in this level of bulk.
Holder of controversial views, all of which my own.

Sir Osis of Liver

I like ahrasis's suggestion.  If nothing legitimate happened during the specified date/time range, how much damage could it cause?  Would it make a difference if the spammers posted in existing topics or started new topics?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

nizarala

Thanks to all of you!

Krash, the spam is only in 2014. Since I did not teach the course in 2014 there is no legitimate post in that period, so I can safely delete all posts made in 2014. I did not see any spam posts inside legitimate topics.

Ahrasis, it would be great if I was able to do this. How do I go about assigning all these posts to one member? I looked around the forum and it was not obvious to me.

Advertisement: