2 personman Jul 30, 2005 05:51

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?
Make sure that the code you inserted goes before the ?> at the end of the file. And after the } that's right above it.
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.' );
}
?>
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.
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
/**
* 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?
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?
Thats a whole different hack - a different feedback_links().
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..
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.