Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 12-23-2015, 02:34 AM
Chris.08i Chris.08i is offline
 
Join Date: Oct 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dragonsys View Post
ok, that is what I gave you the first time
PHP Code:
$vbulletin->GPC['points'] != 
but you said it didn't work. So I changed it to this:
PHP Code:
$vbulletin->GPC['points'] == 

So what determines an infraction vs a warning, in the code?
I am not sure - from what Mark posted earlier, I assumed that
PHP Code:
$vbulletin->GPC['points'
was the code to determine the number of points being issued in the infraction.

So from my understanding:

An infraction that don't carry points
PHP Code:
$vbulletin->GPC['points'] == 
would equal an infraction should skip the bottom code (deduction code).


I have tried either variations, and neither have worked.
Reply With Quote
  #22  
Old 12-23-2015, 02:36 AM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris.08i View Post
I am not sure - from what Mark posted earlier, I assumed that
PHP Code:
$vbulletin->GPC['points'
was the code to determine the number of points being issued in the infraction.

So from my understanding:

An infraction that don't carry points
PHP Code:
$vbulletin->GPC['points'] == 
would equal an infraction should skip the bottom code (deduction code).


I have tried either variations, and neither have worked.
In that case != 0 should cause it to run the subtraction code, which you said it didn't. I will have to look at the hook some.

--------------- Added [DATE]1450845554[/DATE] at [TIME]1450845554[/TIME] ---------------

based on this post:
Quote:
Originally Posted by MarkFL View Post
If you use the code I posted in post #8, then the deduction will be based on the accumulated active points prior to the infraction being issued. So, for example, suppose a user has 3 active points, and you then issue a warning...$userinfo['ipoints'] will be equal to 3.

But, if you use the hook location and variable I suggested in post #10, then $vbulletin->GPC['points'] will be equal to 0.
I would assume that a Warning is
PHP Code:
 $vbulletin->GPC['points'] == 
so an Infraction would be
PHP Code:
 $vbulletin->GPC['points'] != 
You want the points to be deducted with an Infraction, but not a Warning, right?
Reply With Quote
  #23  
Old 12-23-2015, 02:42 AM
Chris.08i Chris.08i is offline
 
Join Date: Oct 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is correct.

The hook I am using is 'infraction_update_complete'
Reply With Quote
  #24  
Old 12-23-2015, 02:46 AM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris.08i View Post
That is correct.

The hook I am using is 'infraction_update_complete'
ok, in that case the first piece of code I posted should work for what you want, but you say it is not actually subtracting the points. Did you get a SQL error?

try this:
PHP Code:
global $vbulletin$db$userinfo;

if (
$vbulletin->GPC['points'] == 0) {
    
$points $userinfo['ipoints'];
    
$rep $userinfo['reputation'];

    if (
$points 0)
    {
        
$newrep = ($rep $points*500);
    }
    else
    {
        
$newrep = ($rep 150);
    }

    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user
        SET reputation = " 
$newrep "
        WHERE userid = " 
$userinfo['userid'] .""
    
);

Reply With Quote
  #25  
Old 12-23-2015, 02:54 AM
Chris.08i Chris.08i is offline
 
Join Date: Oct 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I tried again with == 0 and != 0.

When I tried == 0 - points get deducted when I issue warnings and they don't get deducted when giving an infraction.

When I tried != 0, points are not deducted in either situation.
Reply With Quote
  #26  
Old 12-23-2015, 02:58 AM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris.08i View Post
So I tried again with == 0 and != 0.

When I tried == 0 - points get deducted when I issue warnings and they don't get deducted when giving an infraction.

When I tried != 0, points are not deducted in either situation.
ok, we are making progress at least, lol. Let's try it this way (assuming this will always be a positive or 0):
PHP Code:
global $vbulletin$db$userinfo;

if (
$vbulletin->GPC['points'] > 0) {
    
$points $userinfo['ipoints'];
    
$rep $userinfo['reputation'];

    if (
$points 0)
    {
        
$newrep = ($rep $points*500);
    }
    else
    {
        
$newrep = ($rep 150);
    }

    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "user
        SET reputation = " 
$newrep "
        WHERE userid = " 
$userinfo['userid'] .""
    
);

Reply With Quote
  #27  
Old 12-23-2015, 03:02 AM
Chris.08i Chris.08i is offline
 
Join Date: Oct 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tried that before if I remember correctly. I tried again nevertheless.

Warning does nothing, and infraction does nothing.
Reply With Quote
  #28  
Old 12-23-2015, 03:23 AM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There are minor differences. Ok, let me think on this a bit. I will get a fresh look in the morning.
Reply With Quote
  #29  
Old 12-23-2015, 01:48 PM
Chris.08i Chris.08i is offline
 
Join Date: Oct 2008
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dragonsys View Post
There are minor differences. Ok, let me think on this a bit. I will get a fresh look in the morning.
Thanks.

Perhaps the code to check for the infraction points being handed out is wrong, or the hook is wrong? I am not sure how to check either of these though.
Reply With Quote
  #30  
Old 12-23-2015, 03:06 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Chris.08i View Post
Thanks.

Perhaps the code to check for the infraction points being handed out is wrong, or the hook is wrong? I am not sure how to check either of these though.
I will have to do some checking on my test site and see how GPC['points'] is returned.
I think the hook is right, just need to figure out what is being returned, so we can use it properly
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 01:51 PM.


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.05836 seconds
  • Memory Usage 2,289KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (10)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete