vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Anti-spam post decrementer (https://vborg.vbsupport.ru/showthread.php?t=41112)

Kier 07-15-2002 10:00 PM

Anti-spam post decrementer
 
This is a bit of a silly hack, but a few of my moderators wanted it, so I thought I'd share it with you people.

What it does is when a user posts, the system checks against a list of user IDs, and if the user is in that list, their post count goes down by one, rather than going up by one post. Very silly I know, but anyway...

1) run the following query:
Code:

INSERT INTO setting (settinggroupid, title, varname, description, displayorder) VALUES
(6, 'Users with inverse post counters', 'decrementusers',
'Users in this list will have their post count decremented when they post. Separate user IDs with a comma', 100)

2) in functions.php, add the following code somewhere near the bottom of the file:
Code:

function incrementposts($userid) {
        static $decrementusers;
        if (!is_array($decrementusers)) {
                $decrementusers = explode(',', $GLOBALS['decrementusers']);
        }
        if (in_array($userid, $decrementusers)) {
                return 'posts=posts-1,';
        } else {
                return 'posts=posts+1,';
        }
}

3) in newreply.php and newthread.php, find this code:
Code:

".iif ($foruminfo[countposts],"posts=posts+1,","")."
and replace with this:
Code:

".iif ($foruminfo[countposts], incrementposts($bbuserinfo['userid']), '')."
Then go into your control panel and edit the new setting, inserting something like 1001,2544 to set users 1001 and 2544 to have inverse post counters.

Have fun :classic:

SaintDog 07-15-2002 10:11 PM

Odd little hack, but it is nice to have fun with your members every now and then :).

- SaintDog

Brad 07-15-2002 10:54 PM

i smell a late april 1st :p, love the hack ^_^

Link14716 07-15-2002 11:05 PM

not a particulaly useful hack, but fun to screw around with :-P

Kier 07-15-2002 11:08 PM

Quote:

Originally posted by Link14716
not a particulaly useful hack, but fun to screw around with :-P
I don't remember saying it was useful :p

snyx 07-15-2002 11:17 PM

rolf this is great, Im going to install it to bug all my troll members! hahaha, awesome :D

Neo 07-16-2002 01:20 AM

LOL, nice one Kier.

JulianD 07-16-2002 07:14 AM

Looks very funny hehehe

Boofo 07-16-2002 09:41 AM

What if a user gets down to 0? Will it start counting -1, -2 and so on? Or will it stop at 1? :)

Admin 07-16-2002 10:37 AM

Quote:

Originally posted by Boofo
What if a user gets down to 0? Will it start counting -1, -2 and so on? Or will it stop at 1? :)
It will not go below 0. If you want it to, run this query:
[sql]ALTER TABLE user CHANGE posts posts SMALLINT DEFAULT 0 NOT NULL;[/sql]


All times are GMT. The time now is 12:28 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.01105 seconds
  • Memory Usage 1,728KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete