vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Administrative and Maintenance Tools - Edit infraction points/expiration (3.6-4.x) (https://vborg.vbsupport.ru/showthread.php?t=253413)

MoMan 11-08-2010 10:00 PM

Edit infraction points/expiration (3.6-4.x)
 
1 Attachment(s)
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]")); 


mitch84 11-10-2010 04:27 AM

nice, tagged but I think you should put modification in a file text for download

Hornstar 11-11-2010 09:31 AM

So many times this would have come in handy lol. I wish this was default ^^

Thanks.

diddy29 11-22-2012 02:46 AM

Installed on 4.1.3. Seems to work well at the moment.

I can't believe this hasn't come as a default setting.

It was a bit of a pain though, editing admininfraction.php.


All times are GMT. The time now is 10:15 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01707 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete