Joomla has been annoying me of late on an old 1.5 site. They don’t post a lot of news articles and the ones they do have been getting archived before new ones have been posted to replace them leaving the site looking bare. As a simple solution I wrote this little script which will set ANY and ALL articles in a chosen category and sub-category to Published when they are Archieved. It won’t effect unpublished or deleted items.
Simply upload the script, add your databases’ relevant details and in your templates index.php file at the top add an
include('Location/To/Script');
You can change the category by changing sectionid and catid to the relevant ones from Category and Section Manager.
<?php
//Created By James Krawczyk
//
//Copyright 2012
//Use as you like, sharing, editing, changing etc as long as you give credit
//
//Only valid for Joomla 1.5, May work with others
//
//Version 1.1
//Created By James Krawczyk
//
//Copyright 2012
//Use as you like, sharing, editing, changing etc as long as you give credit
//
//Only valid for Joomla 1.5, May work with others
//
//Version 1.1
$dbloc = ""; //DB Host
$dbusr = ""; //DB User
$dbpass = ""; //DB Pass
$dbname = ""; //DB Name
$dbusr = ""; //DB User
$dbpass = ""; //DB Pass
$dbname = ""; //DB Name
$con = mysql_connect($dbloc,$dbusr,$dbpass);
if (!$con)
{
die('Error with datbase. Could not connect');
}
mysql_select_db($dbname,$con);
{
die('Error with datbase. Could not connect');
}
mysql_select_db($dbname,$con);
mysql_query("UPDATE jom_content SET state = '1' WHERE sectionid = '2' AND catid = '2' AND state = '-1'");
mysql_close($con);
?>
?>
No comments:
Post a Comment