Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Edit infraction points/expiration (3.6-4.x) Details »»
Edit infraction points/expiration (3.6-4.x)
Version: 1.00, by MoMan MoMan is offline
Developer Last Online: Oct 2022 Show Printable Version Email this Page

Category: Administrative and Maintenance Tools - Version: 4.0.8 Rating:
Released: 11-08-2010 Last Update: Never Installs: 12
Re-useable Code Code Changes  
No support by the author.

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]")); 

Screenshots

File Type: png Screenshot-1.png (17.7 KB, 0 views)
File Type: png Screenshot-2.png (10.7 KB, 0 views)
File Type: png Screenshot-3.png (7.4 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 11-10-2010, 04:27 AM
mitch84 mitch84 is offline
 
Join Date: Mar 2008
Location: france
Posts: 516
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice, tagged but I think you should put modification in a file text for download
Reply With Quote
  #3  
Old 11-11-2010, 09:31 AM
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Location: Australia
Posts: 2,469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Thanks.
Reply With Quote
  #4  
Old 11-22-2012, 02:46 AM
diddy29 diddy29 is offline
 
Join Date: Sep 2012
Posts: 21
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:49 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05573 seconds
  • Memory Usage 2,292KB
  • Queries Executed 18 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete