Back to vBulletin 4.x Add-ons

Edit infraction points/expiration (3.6-4.x)
Mod Version: 1.00, by MoMan

vB Version: 4.0.8 Rating: (0 vote - 0 average) Installs: 12
Released: 09 Nov 2010 Last Update: Never Downloads: 0
Not Supported Code Changes Re-usable Code  

This mod will allow you to edit the expiration date and points of infractions through your admin panel. The stock vbulletin installation only supports reversal and deletion, so I think this is a handy addition if you frequently use infractions on your forum. In case someone screws up and adds too many points, issues an infraction instead of a warning, or sets the duration too high, you can use this to make a discrete edit without having to delete and then re-issue the infraction.

This mod doesn't support the editing of other parameters as I didn't see a need for that. If you'd like to add further functionality on your own, you're welcome to modify and re-post this code as long as you give attribution.

Should work with vB 3.6.x and above!

Note: this mod requires additions directly to vbulletin code. I don't recommend you proceed unless you are comfortable with editing PHP files.

Open /admincp/admininfraction.php

Add above print_cp_footer():
PHP Code:
// ###################### Start Edit Infraction #######################
if ($_REQUEST['do'] == 'editinfraction')
{
    
$vbulletin->input->clean_array_gpc('r', array(
        
'infractionid' => TYPE_UINT,
        
'points' => TYPE_UINT,
        
'expires' => TYPE_ARRAY,
        
'submit' => TYPE_UINT
    
));
    
    if (
$infraction $db->query_first("
        SELECT infraction.*
        FROM " 
TABLE_PREFIX "infraction AS infraction
        WHERE infractionid = " 
$vbulletin->GPC['infractionid']
    ))
    {
        
// Are we submitting or editing?
        
if ($vbulletin->GPC['submit'])
        {
            
// Clean up the points
            
$points $vbulletin->GPC['points'];    
            if (
$points 0)
            {
                
$points $infraction['points'];
            }
            
            
// Clean up the expiration date
            
$expires mktime($vbulletin->GPC['expires']['hour'], $vbulletin->GPC['expires']['minute'], 0$vbulletin->GPC['expires']['month'], $vbulletin->GPC['expires']['day'], $vbulletin->GPC['expires']['year']);
            if (
$expires $infraction['dateline'])
            {
                
$expires $infraction['dateline'];
            }
            
            
// Update the infraction
            
$infdata =& datamanager_init('Infraction'$vbulletinERRTYPE_STANDARD);
            
$infdata->set_existing($infraction);
            
$infdata->set('points'$points);
            
$infdata->set('expires'$expires);
            
$infdata->save();
            
            
// Print message
            
print_cp_message($vbphrase['redirecting'], 'admininfraction.php?do=details&infractionid=' $infraction['infractionid'], 5''true);
        }
        else
        {
            
// Print input fields
            
print_form_header('admininfraction','editinfraction');
            
construct_hidden_code('infractionid',$infraction['infractionid']);
            
construct_hidden_code('submit'1);
            
print_table_header($vbphrase['edit'] . ' ' $vbphrase['infraction'] . ' ' $infraction['infractionid']);
            
print_time_row($vbphrase['expires'], 'expires'$infraction['expires']);
            
print_input_row($vbphrase['points'], 'points'$infraction['points']);
            
print_hidden_fields();
            
print_submit_row($vbphrase['submit']);
            
print_table_footer();
        }
    }
    else
    {
        
print_stop_message('no_matches_found');
    }

Find:
PHP Code:
            ' ' construct_link_code($vbphrase['infraction_view'], "admininfraction.php?" $vbulletin->session->vars['sessionurl'] . "do=details&infractionid=$infraction[infractionid]"false''true) . 
Add below:
PHP Code:
' ' construct_link_code($vbphrase['edit'], "admininfraction.php?" $vbulletin->session->vars['sessionurl'] . "do=editinfraction&infractionid=$infraction[infractionid]"false''true) . 
Find:
PHP Code:
if (!empty($infraction['note']))
        {
            
print_label_row($vbphrase['administrative_note'], $infraction['note']);
        } 
Add below:
PHP Code:
print_label_row($vbphrase['edit'],construct_link_code($vbphrase['edit'], "admininfraction.php?" $vbulletin->session->vars['sessionurl'] . "do=editinfraction&infractionid=$infraction[infractionid]")); 

Download

No files for download.

Screenshots

Click image for larger version
Name:	Screenshot-1.png
Views:	227
Size:	17.7 KB
ID:	123508   Click image for larger version
Name:	Screenshot-2.png
Views:	220
Size:	10.7 KB
ID:	123509   Click image for larger version
Name:	Screenshot-3.png
Views:	111
Size:	7.4 KB
ID:	123510  


vblts.ru supports vBulletin®, 2022-2024