melondog
04-01-2002, 10:00 PM
Ok, I made a little hack to send users a PM on their Birthday.
Fixed
First, make a new file, pmbday.txt, and chmod it to 777.
Next open index.php and add this code:
// send PM if Birthday
$message = "Your message here.\n";
$title = "Happy Birthday!!";
$username = $bbuserinfo['username'];
if(vbdate('m-d', time()) == substr($bbuserinfo['birthday'], 5)){
$file = file("pmbday.txt");
while(list(,$value) = each($file)){
list($user, $date) = explode("|", $value);
if($username == $user){
}else{
$touserid = $bbuserinfo['userid'];
$DB_site->query("INSERT INTO privatemessage (privatemessageid, userid,touserid, fromuserid, title, message, dateline, showsignature, iconid, messageread, folderid, receipt) VALUES (NULL,$touserid,$touserid,1,'$title','$message',".time().",0,0,0,0,0)");
if($noshutdownfunc){
$DB_site->query("UPDATE user SET pmpopup=2 WHERE userid=$touserid");
}else{
$shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=2 WHERE userid=$touserid";
}
$date = date("m.d.y");
$fp = fopen("pmbday.txt", a);
fputs($fp, "$username|$date|\n");
fclose($fp);
}
}
} You can add it pretty much anywhere in index.php.
If you have questions or comments, feel free to post them.
Fixed
First, make a new file, pmbday.txt, and chmod it to 777.
Next open index.php and add this code:
// send PM if Birthday
$message = "Your message here.\n";
$title = "Happy Birthday!!";
$username = $bbuserinfo['username'];
if(vbdate('m-d', time()) == substr($bbuserinfo['birthday'], 5)){
$file = file("pmbday.txt");
while(list(,$value) = each($file)){
list($user, $date) = explode("|", $value);
if($username == $user){
}else{
$touserid = $bbuserinfo['userid'];
$DB_site->query("INSERT INTO privatemessage (privatemessageid, userid,touserid, fromuserid, title, message, dateline, showsignature, iconid, messageread, folderid, receipt) VALUES (NULL,$touserid,$touserid,1,'$title','$message',".time().",0,0,0,0,0)");
if($noshutdownfunc){
$DB_site->query("UPDATE user SET pmpopup=2 WHERE userid=$touserid");
}else{
$shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=2 WHERE userid=$touserid";
}
$date = date("m.d.y");
$fp = fopen("pmbday.txt", a);
fputs($fp, "$username|$date|\n");
fclose($fp);
}
}
} You can add it pretty much anywhere in index.php.
If you have questions or comments, feel free to post them.