View Thread
Keep spammers and bots out.
The shoutbox should be part of the core!
Yes, in the core and not as an infusion so it cleans automatically when I remove spammers. Yes, in the core and not as an infusion so it cleans automatically when I remove spammers. 100%[1 Vote]
No, leave it as an infusion/add on. I don't care the extra cleanup work I have to do when I remove spammers. No, leave it as an infusion/add on. I don't care the extra cleanup work I have to do when I remove spammers. 0%[0 Votes]
Total Votes : 1
 Print Thread
Remove member/spammer including shoutbox posts and submissions
Fusioneer
Now and then I got spammers on my site leaving a lot of junk.
When removing a member/spammer the shouts are not automatically deleted. Very annoying. :@

This is because the developers of php fusion decided NOT to include the shoutbox in the core anymore but offer it as an separate infusion/add on. After that point the automatic cleanup was lost.

How to fix that?

Open /administration/members.php and find:
Download source  GeSHi: PHP
  1. // Delete content
  2. $result = dbquery("DELETE FROM ".DB_USERS." WHERE user_id='".$user_id."'");
  3. $result = dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name='".$user_id."'");
  4. $result = dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name='".$user_id."'");
  5. $result = dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to='".$user_id."' OR message_from='".$user_id."'");
  6. $result = dbquery("DELETE FROM ".DB_NEWS." WHERE news_name='".$user_id."'");
  7. $result = dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user='".$user_id."'");
  8. $result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user='".$user_id."'");
  9. $result = dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user='".$user_id."'");
  10. $result = dbquery("DELETE FROM ".DB_THREADS." WHERE thread_author='".$user_id."'");
  11. $result = dbquery("DELETE FROM ".DB_POSTS." WHERE post_author='".$user_id."'");
  12. $result = dbquery("DELETE FROM ".DB_THREAD_NOTIFY." WHERE notify_user='".$user_id."'");
  13. redirect(USER_MANAGEMENT_SELF."&status=dok");
  14.  
Parsed in 0.019 seconds, using GeSHi 1.0.8.10


Add the second last line so it looks like this:
Download source  GeSHi: PHP
  1. // Delete content
  2. $result = dbquery("DELETE FROM ".DB_USERS." WHERE user_id='".$user_id."'");
  3. $result = dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name='".$user_id."'");
  4. $result = dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name='".$user_id."'");
  5. $result = dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to='".$user_id."' OR message_from='".$user_id."'");
  6. $result = dbquery("DELETE FROM ".DB_NEWS." WHERE news_name='".$user_id."'");
  7. $result = dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user='".$user_id."'");
  8. $result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user='".$user_id."'");
  9. $result = dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user='".$user_id."'");
  10. $result = dbquery("DELETE FROM ".DB_THREADS." WHERE thread_author='".$user_id."'");
  11. $result = dbquery("DELETE FROM ".DB_POSTS." WHERE post_author='".$user_id."'");
  12. $result = dbquery("DELETE FROM ".DB_THREAD_NOTIFY." WHERE notify_user='".$user_id."'");
  13. $result = dbquery("DELETE IGNORE FROM ".DB_PREFIX."shoutbox WHERE shout_name='".$user_id."'"); // Mod Wanabo. Don't enable user field shoutbox if you don't have this table
  14. redirect(USER_MANAGEMENT_SELF."&status=dok");
  15.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.10


Why the DELETE IGNORE FROM?
In this way it is safe to make the modification. The ignore statement is just there to ensure no errors are produced in case you haven't infused the shoutbox and therefore no shoutbox tables exists.


Update:
It appears that also submission are left behind when you delete a user.

Update members.php with the following line:
Download source  GeSHi: PHP
  1. $result = dbquery("DELETE FROM ".DB_SUBMISSIONS." WHERE submit_user='".$user_id."'"); // Mod Wanabo. No need for IGNORE because this table exists in the core.
  2.  
Parsed in 0.008 seconds, using GeSHi 1.0.8.10


Together with the cleanup for the shoutbox it would look like this:
Download source  GeSHi: PHP
  1. // Delete content
  2. $result = dbquery("DELETE FROM ".DB_USERS." WHERE user_id='".$user_id."'");
  3. $result = dbquery("DELETE FROM ".DB_ARTICLES." WHERE article_name='".$user_id."'");
  4. $result = dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_name='".$user_id."'");
  5. $result = dbquery("DELETE FROM ".DB_MESSAGES." WHERE message_to='".$user_id."' OR message_from='".$user_id."'");
  6. $result = dbquery("DELETE FROM ".DB_NEWS." WHERE news_name='".$user_id."'");
  7. $result = dbquery("DELETE FROM ".DB_POLL_VOTES." WHERE vote_user='".$user_id."'");
  8. $result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_user='".$user_id."'");
  9. $result = dbquery("DELETE FROM ".DB_SUSPENDS." WHERE suspended_user='".$user_id."'");
  10. $result = dbquery("DELETE FROM ".DB_THREADS." WHERE thread_author='".$user_id."'");
  11. $result = dbquery("DELETE FROM ".DB_POSTS." WHERE post_author='".$user_id."'");
  12. $result = dbquery("DELETE FROM ".DB_THREAD_NOTIFY." WHERE notify_user='".$user_id."'");
  13. $result = dbquery("DELETE IGNORE FROM ".DB_PREFIX."shoutbox WHERE shout_name='".$user_id."'"); // Mod Wanabo. Don't enable user field shoutbox if you don't have this table
  14. $result = dbquery("DELETE FROM ".DB_SUBMISSIONS." WHERE submit_user='".$user_id."'"); // Mod Wanabo. No need for IGNORE because this table exists in the core.
  15. redirect(USER_MANAGEMENT_SELF."&status=dok");
  16.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.10

Edited by Fusioneer on 13-10-2012 14:13
Warning about ParkingCrew.com! Case: ParkingCrew.com acquires NameDrive.com but earnings are not transferred despite assurances and promises. Inquiries about this are ignored! It's just a con compagny. Don't do business with them!
 
Jump to Forum
New Thread Post Reply
Gebruik BBcode of HTML om naar; 'Remove member/spammer including shoutbox posts and submissions', te verwijzen!
BBcode:
HTML:
Vergelijkbare onderwerpen
Subject Discussion Forum         Last Post
Insert an advertisement panel between forum posts Panels, share youre code : 2 16-12-2014