5
in my site some users dont check the inbox for ages and the pms reach to 1000 or higher.
so this is a big problem in the site and i write ( with very help from others ) a php script to delete old unread pms . and that's it :
define("user", "user_db"); // write user of your database here
define("pass", "password"); // write password here
define("host", "localhost"); // change it if your localhost is different
define("db", "database_name"); //write name of your database here
$cxn = mysql_connect(host ,user, pass);
mysql_select_db(db);
$delete_time = time() - ( 30 * 24 * 60 * 60 ); // 30 days/month * 24 hrs/day
// * 60 minutes/hour * 60 seconds/min.
$sql = "DELETE from `xoops_priv_msgs` WHERE `read_msg` = '0' AND `msg_time` < '$delete_time'";
//This script would delete everything older than 30 days that has been not read.
//note: if your perfix is different plz notice that change the 'xoops' with your perfix at 'xoops_priv_msgs' table
$result = mysql_query($sql, $cxn);
?>
put this script in a php file for example delete_pm.php and save it then upload it everywhere u want and run it every time u want.
even u can put this at a chron job and run it every day automatically ( recommended)
you can change the delete time to your favorite.
plz get me some feedback about this and some help to put other fields to script.
for example i want choose a part of "pm subject" so every pm has that part delete and others left. how can do it?
regards