Further improvements..
Plugin: LAM - Save Edited Dispute Resolution Data
What has changed: You just saved the list of disputees everytime, but when quick editing the post the list was empty, this has been fixed as it no longer updates if the request was made via ajax. Now it also only sends out PM notifications if the user has been added to the list and not if they were already on the list (otherwise all tagged members would receive loooots of pm if some noob was editing the thread massively).
New code
Code:
if (!$vbulletin->GPC['ajax'] && ($threadinfo['postuserid'] == $vbulletin->userinfo['userid'] || can_moderate($threadinfo['forumid'], 'caneditthreads'))) {
$vbulletin->input->clean_gpc('p', 'LAM_DisputeResolution_UserNames', TYPE_STR);
$vbulletin->GPC['LAM_DisputeResolution_UserNames'] = trim($vbulletin->GPC['LAM_DisputeResolution_UserNames']);
if(!empty($vbulletin->GPC['LAM_DisputeResolution_UserNames'])) {
$LAM_DisputeResolution_Names = explode(";", $vbulletin->GPC['LAM_DisputeResolution_UserNames']);
unset($LAM_DisputeResolution_SQL, $LAM_DisputeResolution_UIDs);
foreach ($LAM_DisputeResolution_Names AS $LAM_DisputeResolution_Name) {
$LAM_DisputeResolution_Name = $db->escape_string(trim($LAM_DisputeResolution_Name));
if (!empty($LAM_DisputeResolution_Name)) {
$LAM_DisputeResolution_SQL .= ",'$LAM_DisputeResolution_Name'";
}
}
$LAM_PreDisputees = explode(',', $threadinfo['LAM_DisputeResolution']);
$LAM_DisputeResolution_UserInfo = fetch_userinfo($vbulletin->options['LAM_DisputeResolution_FromUserID']);
$LAM_DisputeResolution_SQL = substr($LAM_DisputeResolution_SQL, 1);
$LAM_DisputeResolution_Query = $db->query_read("SELECT userid, username FROM " . TABLE_PREFIX ."user AS user WHERE username IN ($LAM_DisputeResolution_SQL)");
while ($LAM_DisputeResolution_Row = $db->fetch_array($LAM_DisputeResolution_Query)) {
$LAM_DisputeResolution_UIDs .= "," . $LAM_DisputeResolution_Row['userid'];
if(!in_array($LAM_DisputeResolution_Row['userid'], $LAM_PreDisputees)){
$pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
if (empty($vbulletin->options['LAM_DisputeResolution_FromUserID'])) {
$pmdm->set('fromuserid', $vbulletin->userinfo['userid']);
$pmdm->set('fromusername', $vbulletin->userinfo['username']);
} else {
$pmdm->set('fromuserid', $LAM_DisputeResolution_UserInfo['userid']);
$pmdm->set('fromusername', $LAM_DisputeResolution_UserInfo['username']);
}
$pmdm->set('title', $vbphrase['LAM_DisputeResolution_Title']);
$pmdm->set('message', construct_phrase($vbphrase['LAM_DisputeResolution_PMText'], $vbulletin->options['bburl'] . "/showthread.php?" . $vbulletin->session->vars['sessionurl'] . $threadinfo['threadid'] . ""));
$pmdm->set_recipients($LAM_DisputeResolution_Row['username'], $permissions);
$pmdm->set('dateline', TIMENOW);
$pmdm->pre_save();
if (empty($pmdm->errors)) {
$pmdm->save();
}
}
}
$LAM_DisputeResolution_UIDs = substr($LAM_DisputeResolution_UIDs, 1);
$db->free_result($LAM_DisputeResolution_Query);
$db->query_write("UPDATE " . TABLE_PREFIX . "thread SET LAM_DisputeResolution = '" . $LAM_DisputeResolution_UIDs . "' WHERE threadid = " . $threadinfo['threadid'] . "");
}elseif($vbulletin->options['LAM_DisputeResolution_OptionalDisputes']){
$db->query_write("UPDATE " . TABLE_PREFIX . "thread SET LAM_DisputeResolution = '' WHERE threadid = " . $threadinfo['threadid'] . "");
}
unset($LAM_DisputeResolution_Query, $LAM_DisputeResolution_SQL, $LAM_DisputeResolution_Names, $LAM_DisputeResolution_UIDs, $LAM_DisputeResolution_UserInfo, $LAM_PreDisputees);
}
Plugin: LAM - Check Edit Usernames Have Been Given
What has changed: Commented out something you didn't use that was really dumb to include (sorry), but there's no point in it and I had to comment it out to add that "only notify new recipients feature".
New code
Code:
if (!$vbulletin->GPC['ajax'] AND !$vbulletin->GPC['quickeditnoajax'] AND !$vbulletin->GPC['advanced'] AND ($threadinfo['postuserid'] == $vbulletin->userinfo['userid'] || can_moderate($threadinfo['forumid'], 'caneditthreads'))) {
$vbulletin->input->clean_gpc('p', 'LAM_DisputeResolution_UserNames', TYPE_STR);
if ($vbulletin->options['LAM_DisputeResolution_GlobalEnable'] || in_array($foruminfo['forumid'], explode(',', $vbulletin->options['LAM_DisputeResolution_DisputeForumIDs']))) {
if (empty($vbulletin->GPC['LAM_DisputeResolution_UserNames'])) {
if (!$vbulletin->options['LAM_DisputeResolution_OptionalDisputes']) {
eval(standard_error(fetch_error('LAM_DisputeResolution_MissingUserNames')));
}
} else {
$LAM_DisputeResolution_Names = explode(";", $vbulletin->GPC['LAM_DisputeResolution_UserNames']);
foreach ($LAM_DisputeResolution_Names AS $LAM_DisputeResolution_Name) {
$LAM_DisputeResolution_Name = $db->escape_string(htmlspecialchars_uni(trim($LAM_DisputeResolution_Name)));
if (!empty($LAM_DisputeResolution_Name)) {
$LAM_DisputeResolution_Query = $db->query_first("SELECT userid FROM " . TABLE_PREFIX ."user AS user WHERE username = '$LAM_DisputeResolution_Name'");
if ($LAM_DisputeResolution_Query) {
$LAM_DisputeResolution_UIDs .= "," . $LAM_DisputeResolution_Query['userid'];
$db->free_result($LAM_DisputeResolution_Query);
} else {
eval(standard_error(fetch_error('LAM_DisputeResolution_UnknownUserName', $LAM_DisputeResolution_Name)));
}
}
}
}
//Could delete if you want to, just kept it commented to show you what I meant
//$threadinfo[LAM_DisputeResolution] = $vbulletin->GPC['LAM_DisputeResolution_UserNames'];
unset($LAM_DisputeResolution_Query, $LAM_DisputeResolution_Names, $LAM_DisputeResolution_UIDs);
}
}
You could do the above change to the "LAM - Check Usernames Have Been Given" plugin as well