So I added that plugin to infraction_update_start which is near the start of if ($_POST['do'] == 'update') and it didnt work. I'm sure I am doing something wrong though. This is the chunk of code above the $show['pm'] chunk.
PHP Code:
if ($_POST['do'] == 'update')
{
$vbulletin->input->clean_array_gpc('p', array(
'infractionlevelid' => TYPE_UINT,
'warning' => TYPE_ARRAY_BOOL,
'note' => TYPE_STR,
'message' => TYPE_STR,
'iconid' => TYPE_UINT,
'wysiwyg' => TYPE_BOOL,
'parseurl' => TYPE_BOOL,
'signature' => TYPE_BOOL,
'disablesmilies' => TYPE_BOOL,
'receipt' => TYPE_BOOL,
'preview' => TYPE_STR,
'savecopy' => TYPE_BOOL,
'expires' => TYPE_UINT,
'points' => TYPE_STR, // leave as STR
'period' => TYPE_NOHTML,
'customreason' => TYPE_STR,
'banreason' => TYPE_NOHTML,
));
($hook = vBulletinHook::fetch_hook('infraction_update_start')) ? eval($hook) : false;
$errors = array();
$infdata =& datamanager_init('Infraction', $vbulletin, ERRTYPE_STANDARD);
$infdata->setr_info('warning', $vbulletin->GPC['warning']["{$vbulletin->GPC[infractionlevelid]}"]);
$infdata->setr_info('postinfo', $postinfo);
$infdata->setr_info('userinfo', $userinfo);
$infdata->setr_info('threadinfo', $threadinfo);
$infdata->set_info('banreason', $vbulletin->GPC['banreason']);
if ($vbulletin->GPC['points'] !== '')
{
$vbulletin->GPC['points'] = intval($vbulletin->GPC['points']);
}
if (!$vbulletin->GPC['infractionlevelid'] AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cangivearbinfraction'])
{ // custom infraction
if (empty($vbulletin->GPC['customreason']) OR (!$vbulletin->GPC['expires'] AND $vbulletin->GPC['period'] != 'N'))
{
if (empty($vbulletin->GPC['customreason']))
{
$errors[] = 'invalid_custom_infraction_description';
}
if (!$vbulletin->GPC['expires'] AND $vbulletin->GPC['period'] != 'N')
{
$errors[] = 'invalid_timeframe';
}
}
else
{
switch($vbulletin->GPC['period'])
{
case 'D': $expires = mktime(date('H'), date('i'), date('s'), date('m'), date('d') + $vbulletin->GPC['expires'], date('y')); break;
case 'M': $expires = mktime(date('H'), date('i'), date('s'), date('m') + $vbulletin->GPC['expires'], date('d'), date('y')); break;
case 'N': $expires = 0; break;
case 'H':
default:
$expires = mktime(date('H') + $vbulletin->GPC['expires'], date('i'), date('s'), date('m'), date('d'), date('y')); break;
}
$infdata->set('expires', $expires);
$infdata->set('points', $vbulletin->GPC['points']);
$infdata->set('customreason', $vbulletin->GPC['customreason']);
}
if ($vbulletin->GPC['points'] AND empty($vbulletin->GPC['banreason']) AND ($infractionban OR ($minimumpointsban AND $vbulletin->GPC['points'] + $userinfo['ipoints'] >= $minimumpointsban)))
{
$errors[] = 'invalid_banreason';
}
}
else
{
$infractionlevel = verify_id('infractionlevel', $vbulletin->GPC['infractionlevelid'], 1, 1);
if ($infractionlevel['extend'])
{
if (isset($infcache["$infractionlevel[infractionlevelid]"]['expires']))
{
if ($infcache["$infractionlevel[infractionlevelid]"]['expires'] == 0)
{
$infdata->set('expires', 0);
}
else if (($expiretime = $infcache["$infractionlevel[infractionlevelid]"]['expires'] - TIMENOW) > 0)
{
switch($infractionlevel['period'])
{
case 'D': $expires = $expiretime + mktime(date('H'), date('i'), date('s'), date('m'), date('d') + $infractionlevel['expires'], date('y')); break;
case 'M': $expires = $expiretime + mktime(date('H'), date('i'), date('s'), date('m') + $infractionlevel['expires'], date('d'), date('y')); break;
case 'N': $expires = 0; break;
case 'H':
default:
$expires = $expiretime + mktime(date('H') + $infractionlevel['expires'], date('i'), date('s'), date('m'), date('d'), date('y')); break;
}
$infdata->set('expires', $expires);
}
}
}
if (!$vbulletin->GPC['warning']["{$vbulletin->GPC[infractionlevelid]}"] AND empty($vbulletin->GPC['banreason']) AND ($infractionban OR ($minimumpointsban AND $infractionlevel['points'] + $userinfo['ipoints'] >= $minimumpointsban)))
{
$errors[] = 'invalid_banreason';
}
$infdata->setr_info('infractionlevel', $infractionlevel);
$infdata->set('infractionlevelid', $vbulletin->GPC['infractionlevelid']);
}
$banusergroupid = 0;
$liftdate = 0;
if (!empty($banlist) AND $points = $infdata->fetch_field('points'))
{
// Look for the longest ban that applies
foreach ($banlist AS $ban)
{
if (($ban['method'] == 'infractions' AND $ban['amount'] == $totalinfractions + 1) OR ($ban['method'] == 'points' AND $ban['amount'] <= $userinfo['ipoints'] + $points))
{
if ($ban['liftdate'] == 0)
{
$liftdate = 0;
$banusergroupid = $ban['banusergroupid'];
break;
}
else if ($liftdate <= $ban['liftdate'])
{
$liftdate = $ban['liftdate'];
$banusergroupid = $ban['banusergroupid'];
}
}
}
if ($banusergroupid AND !$liftdate)
{
$nocontact = true;
}
}
$infdata->set('whoadded', $vbulletin->userinfo['userid']);
$infdata->set('postid', $postinfo['postid']);
$infdata->set('note', fetch_censored_text($vbulletin->GPC['note']));
// include useful functions
require_once(DIR . '/includes/functions_newpost.php');
require_once(DIR . '/includes/functions_misc.php');
// unwysiwygify the incoming data
if ($vbulletin->GPC['wysiwyg'])
{
require_once(DIR . '/includes/functions_wysiwyg.php');
$vbulletin->GPC['message'] = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $vbulletin->options['privallowhtml']);
}
// parse URLs in message text
if ($vbulletin->options['privallowbbcode'] AND $vbulletin->GPC['parseurl'])
{
$vbulletin->GPC['message'] = convert_url_to_bbcode($vbulletin->GPC['message']);
}
if ($show['pm'])
{
if (empty($vbulletin->GPC['message']) AND $vbulletin->options['uimessage'] AND !$nocontact)
{
$errors[] = 'nomessagetouser';
}
$pm['message'] =& $vbulletin->GPC['message'];
$pm['parseurl'] =& $vbulletin->GPC['parseurl'];
$pm['savecopy'] =& $vbulletin->GPC['savecopy'];
$pm['signature'] =& $vbulletin->GPC['signature'];
$pm['disablesmilies'] =& $vbulletin->GPC['disablesmilies'];
$pm['receipt'] =& $vbulletin->GPC['receipt'];
$pm['iconid'] =& $vbulletin->GPC['iconid'];
// *************************************************************
// PROCESS THE MESSAGE AND INSERT IT INTO THE DATABASE