Don't you love it when a user goes on holidays from the forum that the EI Mod runs on? The person has of course set an out-of-office message in his/her native tongue which does not contain a single word that could be trapped by the out-of-office filter in your mail server. You wake up in the morning to find dozens of bounced messages in your mailbox and posts in the forum with a few expletives from frustrated users in different time zones.
This hack works for users of the old message format. It compares the beginning of the new message to the first 100 characters of the user's previous message and, if identical, removes the message from the mailbox.
Find the line 264 in emailintegration.php, version 2.6.1 BETA:
Code:
$mailmessage = preg_replace($pattern, $replace, $mailmessage);
Insert the following code after line 264:
Code:
if ( $userid ) {
$getlastpost = $vbulletin->db->query_first("
SELECT lastpostid
FROM " . TABLE_PREFIX . "user
WHERE userid = $userid
");
$lastpostid = $getlastpost['lastpostid'];
// lastpostid is not always updated
if ( !$lastpostid ) {
$getlastpost2 = $vbulletin->db->query_first("SELECT postid FROM " . TABLE_PREFIX . "post WHERE userid = $userid ORDER BY dateline DESC, postid DESC LIMIT 1");
$lastpostid = $getlastpost2['postid'];
}
if ( $lastpostid ) {
$gettext = $vbulletin->db->query_first("
SELECT pagetext
FROM " . TABLE_PREFIX . "post
WHERE postid = $lastpostid
");
$pagetext = $gettext['pagetext'];
$pagetext_comp = substr( $pagetext, 0, 100 );
$mailmessage_comp = substr( $mailmessage, 0, 100 );
if ( $pagetext_comp === $mailmessage_comp ) {
imap_delete($mailbox,$msgno);
continue;
}
}
}