Recent Topics

1 Jul 30, 2005 03:50    

I read the article posted by EdB at:

http://wonderwinds.com/hackblog.php/2004/11/02/closing_the_door_on_comment_spammers

and would like to know WHERE in those two files he mentions these additions needs to be placed.

Thanks!

W. Hill

2 Jul 30, 2005 05:51

The first block of code can go anywhere in that file. You're just defining a function, so it doesn't really matter where it goes. Tack it on to the end of the file.

The second chuch of code, the one that goes in your skin file can go wherever you want that link to show up. Somewhere in the sidebar, probably. If you're using custom, then put it in the Misc section of the sidebar.

3 Jul 30, 2005 10:30

Ok -- I followed the directions and got this error:

Parse error: parse error, unexpected '=' in /home/reformed/public_html/blog/b2evocore/_functions.php on line 1341

Any ideas?

4 Jul 30, 2005 14:20

Make sure that the code you inserted goes before the ?> at the end of the file. And after the } that's right above it.

5 Jul 30, 2005 16:55

personman wrote:

Make sure that the code you inserted goes before the ?> at the end of the file. And after the } that's right above it.

Ya...mine is like that as indicated below:

debug_log( "Sending mail from $from to $to - subject $subject." );

return @mail( $to, $subject, $message, $headerstring );
}
function auto_close_comments($before='', $after='', $days='45')
{
global $DB, $tableposts, $localtimenow;
$sql; = "UPDATE $tableposts SET post_comments='closed' WHERE post_comments='open' AND post_issue_date < '".date( 'Y-m-d', $localtimenow - ($days; * 86400) )."'";
$rows_affected; = $DB->query( $sql );
echo $before."Closed comments on ".$rows_affected." posts".$after;
debug_log( 'Comments Closed: closed '.$rows_affected.' rows.' );
}
?>

6 Jul 30, 2005 17:39

This is just an idea, but maybe there's not supposed to be a semicolon after $sql in the line

$sql; = "UPDATE $tableposts SET post_comments='closed' WHERE post_comments='open' AND post_issue_date < '".date( 'Y-m-d', $localtimenow - ($days; * 86400) )."'"; 

Try removing it to see if the error goes away. If that doesn't work then you may have to ask EdB about it.

7 Jul 30, 2005 19:25

personman wrote:

This is just an idea, but maybe there's not supposed to be a semicolon after $sql in the line

$sql; = "UPDATE $tableposts SET post_comments='closed' WHERE post_comments='open' AND post_issue_date < '".date( 'Y-m-d', $localtimenow - ($days; * 86400) )."'"; 

Try removing it to see if the error goes away. If that doesn't work then you may have to ask EdB about it.

Nope...nothing doing..still getting an error. EdB, where are you! :D

8 Jul 30, 2005 22:23

/**
 * close comments on old posts by logging in
 */
function auto_close_comments($before='', $after='', $days='21')
{
	global $DB, $tableposts, $localtimenow;
	$sql = "UPDATE $tableposts SET post_comments='closed' WHERE post_comments='open' AND post_issue_date < '".date( 'Y-m-d', $localtimenow - ($days * 86400) )."'";
	$rows_affected = $DB->query( $sql );
	echo $before."Closed comments on ".$rows_affected." posts".$after;
	debug_log( 'Comments Closed: closed '.$rows_affected.' rows.' );
}

This is the code from my conf/hacks.php file - I originally had it in b2evocore/_functions.php but upgradability is easier if it's in conf/hacks. Either way, your error message talks about an equals sign on line 1341, so I'd look at that line first. Problem is you can get an error on line NNN for something wrong a line or two or three above NNN. Anyway that's where I'd be looking. Do you have "==" where "=" is supposed to be? Or maybe in the first line do you have "equals double-quote" instead of "equals single-quote single-quote"? It's supposed to be 2 single quote marks. Does your $global line end with a semicolon?

9 Jul 31, 2005 00:17

Well...I got it to work (I think) but it did not cross out the comments / trackbacks link as it does on your site EdB...is there something I am missing?

10 Jul 31, 2005 01:26

Thats a whole different hack - a different feedback_links().

11 Mar 21, 2006 15:21

A manual sql would be something like

UPDATE evo_posts SET post_comments='closed' WHERE post_comments='open' AND post_issue_date < '2006-01-01'


if you would want to close alle comments from posts from before januari 1st of 2006

You run that sql statement in you phpmyadmin..


Form is loading...