Jump to content

sql query / mass mark as spammer?


Omri Amos

Recommended Posts

Hello,

I have many spammers that have registered using mail.ru / inbox.ru email addresses, and have 0 posts (they use their account to access other sections of the website, that doesn't affect the posts count).

I have created a ban-filter for this, but I already have existing fake users that are still active.

I want to mark all of them as spammers - all users with ".ru" emails with 0 posts.
I can see all of them in the admin panel (members section), but I have more than 500 users and there's no way (as far as I can see) to mass "mark as spammer" all of them.

Doing this one by one is a nightmare.
Is there a way to overcome this?

Otherwise I might just do a direct DELETE from the sql table for these users... Is this going to create problems?

Thanks

 

Link to comment
Share on other sites

I would suggest doing an advanced search in your ACP for email domains that contain those and then either mass move these to a group you desire or mass prune them at that time. I would highly suggest not running DELETE queries directly in the database.

Link to comment
Share on other sites

On 6/17/2017 at 8:35 PM, Jim M said:

I would suggest doing an advanced search in your ACP for email domains that contain those and then either mass move these to a group you desire or mass prune them at that time.

This is what I did but there's no way to mass-do anything with the search results...

Oh, I just noticed the 2 links to prune / move all of them. But... the search results does have some legitimate users that I want to exclude from the mass-delete, I was looking for a way to "select all", unselect a few members manually, and then do some actions with the selected members.
This is the "manage members" page - why there is no checkboxes next to each member that will allow the admin to mass-manage multiple members at once? that's too bad... Also an option to choose how many members per page to display would be nice.

I guess I can mas move all of them to a new group, then remove the specific members away from this group, and then do a search for this group and prune all of them.

Link to comment
Share on other sites

Script like that will be better, as I think

<?php
// script located in document root
require 'init.php';

// you need to have authenticated session with mod permissions for doing that
\IPS\Session\Front::i(); // init session - after that IPS can see you as loggedIn member, if session exist

foreach (\IPS\Db::i()->select('member_id', 'core_members', 'email like "%mail.ru" AND member_last_post is NULL') as $spammer_id) {
 	$spammer = \IPS\Member::load($spammer_id);
  	$spammer->flagAsSpammer();
  	print_r('Member '.$spammer->name.' with email '.$spammer->email.' marked as spammer'.PHP_EOL);
}

I write this script here and didn't check them. Check it first before running on production.

With SQL you can simply restrict users from posting with command:

UPDATE core_members SET restrict_post = -1 WHERE email LIKE '%mail.ru' AND member_last_post IS NULL;

After that script member didn't set as spammer. But you can mass restrict their from posting very fast. But it's not good way for doing that. Better is using standard IPS method as I wrote at bottom.

Hope this will help you

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...