View Single Post
  #3 (permalink)  
Old 05-27-2007, 01:15 AM
The Humanaught The Humanaught is offline
Casual Pligger
 
Join Date: Jun 2006
Posts: 86
Thanks: 8
Thanked 12 Times in 6 Posts
Cool [solved] Tougher Killspam Method

Hi folks, finally had a chance to take a look at this today, and think I've come up with a stronger solution than the default Killspam function.

Basically, I hate clogging up my database with discarded stories that are spam. So, here is how to modify your Killspam function to really KILL the spam, not just sweep it under the rug.

I've been testing it on my site and it seems to work, but let me know if I'm missing something and am freckin' up things.

This method simply adds a second option to the Killspam This User page (accessed via the User Management page). It does not remove/replace the original function, so if you just want to bruise the spam, and not kill it - you'll still have that option.

Step 1: admin_users.php
Find the function called "yeskillspam" (around line 313) and follow it down to where it ends (around line 343) and insert the following code:
PHP Code:
//////////////////////////////////// NEW KILL SPAM //////////////////////////////////////////
        
if ($_GET["mode"] == "yeskillspam2"){ // killspam step 2
            
$user$db->get_row('SELECT * FROM ' table_users .' where user_login="'.$_GET["user"].'"');
            
            
canIChangeUser($user->user_level);
            
            if (
$user) {
                
                
$db->query('DELETE FROM `' table_users '` WHERE `user_id` = "'.$_GET["id"].'"');
                
$db->query('DELETE FROM `' table_links '` WHERE `link_author` = "'.$_GET["id"].'"');
                
$db->query('DELETE FROM `' table_comments '` WHERE `comment_user_id` = "'.$_GET["id"].'"');
                
                
// breadcrumbs and page title
                
$navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
                
$navwhere['link1'] = getmyurl('admin''');
                
$navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_1');
                
$navwhere['link2'] = my_pligg_base "/admin_users.php";
                
$navwhere['text3'] = $main_smarty->get_config_vars('PLIGG_Visual_Breadcrumb_User_Disable_2');
                
$main_smarty->assign('navbar_where'$navwhere);
                
$main_smarty->assign('posttitle'" / " $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
                
                
// pagename
                
define('pagename''admin_users'); 
                
$main_smarty->assign('pagename'pagename);

                
header("Location: ".my_pligg_base."/admin_users.php");
                
                
            }
            else{
showmyerror('userdoesntexist');}
            
        }
/////////////////////////////////// END New KILL SPAM //////////////////////////////////// 
Step 2: /templates/yget/admin_templates/user_killspam_step1_center.tpl
Replace this:
HTML Code:
<fieldset><legend><img src="{$my_pligg_base}/templates/{$the_template}/images/user_killspam.png" align="absmiddle" /> {#PLIGG_Visual_Breadcrumb_User_Killspam#}</legend>
<table style="border:none">
	<tr><td>{#PLIGG_Visual_View_Killspam_Step1#}</td></tr>
	<tr><td><a href = "{$my_pligg_base}/admin_users.php?mode=yeskillspam&user={$user}&id={$id}">{#PLIGG_Visual_Ban_Link_Yes#}</a>&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;<a href="javascript:history.back()">{#PLIGG_Visual_Ban_Link_No#}</a></tr></td>
</table>
</fieldset> 
With this:
HTML Code:
<fieldset><legend><img src="{$my_pligg_base}/templates/{$the_template}/images/user_killspam.png" align="absmiddle" /> {#PLIGG_Visual_Breadcrumb_User_Killspam#}</legend>
<table style="border:none">
	<tr><td>{#PLIGG_Visual_View_Killspam_Step1#}</td></tr>
	<tr><td>Bruise The Spam: <a href = "{$my_pligg_base}/admin_users.php?mode=yeskillspam&user={$user}&id={$id}">{#PLIGG_Visual_Ban_Link_Yes#}</a>&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;<a href="javascript:history.back()">{#PLIGG_Visual_Ban_Link_No#}</a></tr></td>
	<tr><td>Slaughter The Spam: <a href = "{$my_pligg_base}/admin_users.php?mode=yeskillspam2&user={$user}&id={$id}">{#PLIGG_Visual_Ban_Link_Yes#}</a>&nbsp;&nbsp;&nbsp;| &nbsp;&nbsp;&nbsp;<a href="javascript:history.back()">{#PLIGG_Visual_Ban_Link_No#}</a></tr></td>
</table>
</fieldset> 
Now when you visit the Kill Spam page, you'll be presented with two options instead of one. The first option, "Bruise The Spam", is the original Pligg default Kill Spam, the second option, "Slaughter The Spam", is the tougher - scrub it from the database - method.

This removes the offending user, all their posts and all their comments from the MySQL database.

*** PLEASE PLEASE PLEASE BACKUP YOUR DATABASE AND THE RELATED FILES BEFORE USING THIS - IT WORKS FOR ME BUT I MAKE NO GUARANTEES ***
__________________
The Hao Hao Report: The Best Stories About China
Reply With Quote
The Following 4 Users Say Thank You to The Humanaught For This Useful Post: