MobileHacks
New Member
What this mod does is PM a user when their thread is deleted, containing the deletion reason (or "None Specified.")
The code change (see below) is only required for "Delete Thread" from inside a thread.
v1.0.0
Instructions:
Import XML
Open postings.php and find:
If you are using default vBulletin 3.7.2 PL1 files, it is line 392.
After add:
The code change (see below) is only required for "Delete Thread" from inside a thread.
v1.0.0
- Initial Release for 3.7.x (Note: there may be file changes between different 3.7.x versions, if needed I'll provide instructions for another 3.7.x, but the installation instructions should cover it.)
Instructions:
Import XML
Open postings.php and find:
PHP:
if ($_POST['do'] == 'dodeletethread')
...
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
$delinfo = array(
'userid' => $vbulletin->userinfo['userid'],
'username' => $vbulletin->userinfo['username'],
'reason' => $vbulletin->GPC['deletereason'],
'keepattachments' => $vbulletin->GPC['keepattachments']
);
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->delete($foruminfo['countposts'], $physicaldel, $delinfo);
unset($threadman);
build_forum_counters($threadinfo['forumid']);
If you are using default vBulletin 3.7.2 PL1 files, it is line 392.
After add:
PHP:
// PM on Deletion
if($vbulletin->options['pmondelete_enable']) {
if($threadinfo['postuserid']) {
$thread = $threadinfo;
$pmdB = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "user WHERE userid=" . $thread[postuserid] . " LIMIT 1");
$pmdb = $db->fetch_array($pmdB);
if($delinfo[reason]) $reason = $delinfo[reason];
if(!$delinfo[reason])$reason = "None Specified.";
$replacearr = array('$user','$title','$reason','$bbtitle');
$replaceArr = array($pmdb[username],$thread[title],$reason,$vbulletin->options[bbtitle]);
$message = str_replace($replacearr,$replaceArr,$vbulletin->options[pmondelete_message]);
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
$pmdm->set('fromuserid', $vbulletin->userinfo[userid]);
$pmdm->set('fromusername', $vbulletin->userinfo[username]);
$pmdm->set('title', $vbulletin->options[deleteonpm_title]);
$pmdm->set('message', $message);
$pmdm->set_recipients($pmdb[username], $botpermissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->save();
}
}
// PM on Deletion