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)
-   -   Prune doesn't reduce user post count (https://vborg.vbsupport.ru/showthread.php?t=12420)

tubedogg 03-26-2001 10:00 PM

Someone mentioned this in the other forum (I think it was Castel). It's hardly a hack, as it consists of commenting out 3 lines, but here's how to do it:

In functions.php (in the /admin directory) find
Code:

// ###################### Start delete thread #######################
It should be around line 1450, somewhere in there. Now, a few lines below that, find
Code:

                        if ($countposts) {
                                $DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$post[userid]'");
                        }

and replace it with
Code:

//                        if ($countposts) {
//                                $DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$post[userid]'");
//                        }

Then, a few lines below that, find
Code:

// ###################### Start delete post #######################
A few lines below that, find
Code:

                if ($countposts) {
                        $DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
                }

and replace it with
Code:

//                if ($countposts) {
//                        $DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
//                }

Now when you prune (or a post is deleted) the users' post count won't decrease.

03-27-2001 05:40 AM

Whoa that's actually pretty good, I wonder if it's possible to do the same with the board's post count?

03-27-2001 07:36 AM

Oh btw I have another question, does the counter still work when you delete a thread? I mean if you delete a thread will it reduce that user's post count?

03-27-2001 07:40 AM

With this hack, any time a post is deleted (be it via Pruning or by the user himself or the moderator of the forum, and whether you are deleting an individual post or a whole thread), the user's post count is *not* affected. So this makes his count truly a full count of the total number of posts he has made since registering. The reason it works this way is all the different ways to delete a post - pruning, moderator deleting, user deleting, thread being deleted - rely on these two functions to work. Once you remove the reduce count functionality from these two places, no matter how a post is deleted, the user's count stays the same.

03-27-2001 07:58 AM

I see, the only drawback would be if a user spammed the board intentionaly to raise his or her post count, and then deleted his threads.

I guess if you don't allow users to delete their threads, but only to edit them you kinda solve this problem!
Nice hack indeed man!

03-29-2001 05:28 PM

I guess I'm the only person that likes it the way it is now. I like the fact that when a post is deleted, the post count goes down.

Messages are only deleted on my board for one main reason: The user accidentally double-posted. When I see a double post, I delete one. It makes things look nicer. And I don't think someone should get positive credit for a mistake, even if a genuine, simple mistake.

Now we have a very progressive moderating attitude on my board. We will allow a lot of stuff to go by, as long as people are not attacking each other, etc. But when situations do come up, I prefer to edit or censor, rather than deleting the message. By editing the message, and putting an explanation in the edited message, the person who posted the offending message will see right away that what he did was not acceptable, and will have an explanation. This is preferable, in my opinion, that the person coming back and seeing his message missing, and not knowing what is going on.

So deleting a post is not normally done on my board, and only as a very last resort. So if something is deleted, it was because it was very, very bad, and once again, I do not feel someone should continue to get positive credit, to keep credit for that post, if it was so bad that it had to be deleted.

Now I have things set so nobody can delete their own messages or threads, so we do not have a situation of innocent people getting their counts lowered because someone deleted the first post.

03-30-2001 07:38 AM

You might want to read what I wrote here at the bottom:

http://vbulletin.com/forum/showthrea...threadid=12189

This entire hack is redundent.

Instead of so many code lines, you can achieve exactly the same result by changing in functions.php:

Code:

function deletethread($threadid,$countposts=1)
to

Code:

function deletethread($threadid,$countposts=0)
(this will ensure that post count does not get decreased when a thread is deleted)

and if you want post count not to change when specific posts are deleted as well, then in function.php change:

Code:

function deletepost($postid,$countposts=1,$threadid=0)
to

Code:

function deletepost($postid,$countposts=0,$threadid=0)

Streicher 05-27-2001 07:00 AM

hmm, bira's version of the hack does not work in vB 2.0 final and tubedogg`s first replacement is not anywhere in the funcions.php of the final release.

Can you help me?


Edit: forgotten the word "not" :rolleyes:

JamesUS 05-27-2001 08:17 AM

Quote:

bira's version of the hack does work in vB 2.0 final
If bira's hack works what do you need help with? :)

Streicher 05-27-2001 08:44 AM

Quote:

Originally posted by JamesUS


If bira's hack works what do you need help with? :)

Ups :rolleyes:

I have forgotten the little word "not". Bira's version of the hack does not work, too.

bira 05-29-2001 01:07 AM

If you change $countposts=1 to $countposts=0 then there is no way on earth that the post count will change for the user when you delete.


it WILL change if you run "update counters", because that operation is a simple COUNT query of the database. So, if you don't want your users' post count to ever change, then change $countpost to equal 0, and never run "update counters" :D

BluSmurf 05-29-2001 03:33 PM

sorry bira but I've too tried your hack and it didnt work. :(

bira 05-29-2001 07:00 PM

this isn't my "hack" and I don't support it, nor use it myself so I'm sorry if this comes off rude, but I don't really care :D ;)

Christian 06-11-2001 10:12 AM

Does anyone know which lines to modify in 2.0?

Here are the functions:

Code:

// ###################### Start delete thread #######################
function deletethread($threadid,$countposts=1) {
  global $DB_site;

  // decrement users post counts
  if ($threadinfo=getthreadinfo($threadid)) {
    $postids="";
    $attachmentids="";

    $posts=$DB_site->query("SELECT userid,attachmentid,postid FROM post WHERE threadid='$threadid'");
    while ($post=$DB_site->fetch_array($posts)) {
      if ($countposts) {
        if (!isset($userpostcount["$post[userid]"])) {
          $userpostcount["$post[userid]"] = -1;
        } else {
          $userpostcount["$post[userid]"]--;
        }
      }
      $postids.=$post['postid'].",";
      $attachmentids.=$post['attachmentid'].",";
    }

    if (is_array($userpostcount)) {
      while(list($postuserid,$subtract)=each($userpostcount)) {
        $DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");
      }
    }

    if ($attachmentids!="") {
      $DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($attachmentids"."0)");
    }
    if ($postids!="") {
      $DB_site->query("DELETE FROM searchindex WHERE postid IN ($postids"."0)");
      $DB_site->query("DELETE FROM post WHERE postid IN ($postids"."0)");
    }
    if ($threadinfo['pollid']!=0) {
      $DB_site->query("DELETE FROM poll WHERE pollid='$threadinfo[pollid]'");
      $DB_site->query("DELETE FROM pollvote WHERE pollid='$threadinfo[pollid]'");
    }
    $DB_site->query("DELETE FROM thread WHERE threadid='$threadid'");
    $DB_site->query("DELETE FROM thread WHERE open=10 AND pollid='$threadid'"); // delete redirects
    $DB_site->query("DELETE FROM threadrate WHERE threadid='$threadid'");
    $DB_site->query("DELETE FROM subscribethread WHERE threadid='$threadid'");
  }
}

// ###################### Start delete post #######################
function deletepost($postid,$countposts=1,$threadid=0) {
  global $DB_site;

  // decrement user post count
  if ($postinfo=getpostinfo($postid)) {
    if ($countposts) {
      $DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
    }
    if ($postinfo['attachmentid']) {
      $DB_site->query("DELETE FROM attachment WHERE attachmentid=$postinfo[attachmentid]");
      $DB_site->query("UPDATE thread SET attach = attach - 1 WHERE threadid = '$threadid'");
    }

    $DB_site->query("DELETE FROM searchindex WHERE postid=$postid");
    $DB_site->query("DELETE FROM post WHERE postid='$postid'");
  }
}

Thanks in advance

Blue2000 06-13-2001 05:42 PM

here Christian i done this and it worked fine for me

// if ($countposts) {
// if (!isset($userpostcount["$post[userid]"])) {
// $userpostcount["$post[userid]"] = -1;
// } else {
// $userpostcount["$post[userid]"]--;
// }
// }

MichaelG 06-14-2001 07:39 AM

I still get errors, does any1 know which functions to modify?

Thnx i a

Michael

OK, found out myself:
In functions.php search for:

// ###################### Start delete thread #######################
function deletethread($threadid,$countposts=1) {
global $DB_site;

// decrement users post counts
if ($threadinfo=getthreadinfo($threadid)) {
$postids="";
$attachmentids="";

$posts=$DB_site->query("SELECT userid,attachmentid,postid FROM post WHERE threadid='$threadid'");
while ($post=$DB_site->fetch_array($posts)) {
if ($countposts) {
if (!isset($userpostcount["$post[userid]"])) {
+++OLD+++ $userpostcount["$post[userid]"] = -1; +++OLD+++
$userpostcount["$post[userid]"]--;
} else {
$userpostcount["$post[userid]"]--;
}

So all you have to do is change $userpostcount["$post[userid]"] = -1; to $userpostcount["$post[userid]"]--;

This was for deleting threads, deleting posts works as shown by tubedogg
Hope I could help some1 with that...

Cya
Michael

Dolamite 06-30-2001 06:01 PM

i get these errors when following the above directions..... i have 2.0.1

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in MY LOCATION (EDITED OUT)functions.php on line 1554

Warning: Cannot add header information - headers already sent by (output started at MY LOCATION (EDITED OUT)functions.php:1554) in MY LOCATION (EDITED OUT)functions.php on line 1183

Fatal error: Call to undefined function: makelogincode() in MY LOCATION (EDITED OUT)global.php on line 299

Warning: Unable to call doshutdown() - function does not exist in Unknown on line 0

weezle 07-21-2001 03:22 AM

Cant get this hack to work with VBBFinal??? Can someone help me

TripleH 07-21-2001 05:08 AM

Ok. I got the threads one to work now because of the new hack posted..

whenever i try to use tubedogg's hack about the deleted posts one, it always gives me errors...

Something wrong??

Christine 09-10-2001 12:23 AM

Is there a clean set of instructions for not reducing member or board counts on delete for 2.0.3?

Thanks!!! :D

padd 10-09-2001 09:44 AM

Yeah a version for 2.0.3 would be great please

Chris Stewart 10-14-2001 03:58 AM

Could someone post the whole modded fuctions.php doc for us newbies?:D

Freddie Bingham 10-14-2001 04:17 AM

You can not post source code.

Chris Stewart 10-14-2001 04:20 AM

Could you email me the page or send it over PM or something? All my info is in my profile. I would do it myself but for some reason my whole fuctions.php (and others) file is all thrown together. It's not laid out all nice and neat.

Email is Fool1515@mediaone.net

Heineken77 10-16-2001 04:47 AM

Quote:

Originally posted by bira
If you change $countposts=1 to $countposts=0 then there is no way on earth that the post count will change
LMFAO .. sorry ... but I found this VERY amusing ;) ehehheehehe

Thanks bro :)

almighty one 10-23-2001 10:11 PM

come on someone must have worked this out please post how i hate to revert my functions template back to older version to use this

Heineken77 10-24-2001 05:54 AM

I've been waiting for a definitive answer myself :(

defweb 10-27-2001 01:58 AM

need a definitive answer for version 2.03 still

Matt 11-08-2001 12:34 AM

HELP!!!!!!!

I tried this and it totally mucked my boards post counts up. Can someone please say what I need to do for the latest version of Vbulletin???

ToraTora! 11-23-2001 09:47 AM

First of all, there are many ways of doing this hack, and tubedogs hack, for no decrease in the posting numbers is the best way that I can think of. There are other ways, but to be honest, the way I combined my idea, with tubedog's works just fine.

I will not support this for anybody, because i realize this hack has already received its share of complaints, so keep in mind these simple rules, before taking my advice.

1) Tubedog had origionally created this hack. I'm just adding on to it.

2) all changes, are user responsibility. Backup your functions.php file, and if there are errors, than either figure them out on your own, or go back to your old backed up script, because support is something that I truely tried to provide early on in this game, however, most people are here on a take it and run basis, so I provide this information, on the same premise.

3) Do not Pm me, aol me, icq me, yahoo me, or email me concerning the price of cheese on this hack. respond to this thread if you would like any type of support, which as earlier written, sparse if any.

4) Its a simple hack, so for God's sake read what is written, and all will be ok. :)

Here are the changes.

you will find these script lines in your functions.php script(functions.php is found in your admin folder)

Find on line 1837, (or around there) to start in the correct area of the needed changes:

PHP Code:

// ###################### Start delete thread ####################### 

a few lines down, on line 1866, (or around there), you will find this line:
PHP Code:

 if (is_array($userpostcount)) {
      while(list(
$postuserid,$subtract)=each($userpostcount)) {
        
$DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");
      }
    } 

you can do one of two things.

1) completely take the script out, which is what i did

2) comment out the script such as below.

PHP Code:

 //if (is_array($userpostcount)) {
 // while(list($postuserid,$subtract)=each($userpostcount)) {
 //$DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");
  //    }
    //} 

either way, the script will not execute.




Secondly, Thanks to Tubedog, make these modifications.
(the line numbers, and some variables may of changed, but the basic principle remains).

Find on line 1886 (or around there) this line, to start in the correct area of the needed changes:

PHP Code:

// ###################### Start delete post ####################### 

than, a little bit further down, on line 1892 (or around there) find:

PHP Code:


// decrement user post count
  
if ($postinfo=getpostinfo($postid)) {
    if (
$countposts) {
    
$DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
    } 

and than comment it out as shown below.

PHP Code:


// decrement user post count
  
if ($postinfo=getpostinfo($postid)) {
    
//if ($countposts) {
    //$DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
    //} 




NOTE!!!: i did not comment out:
PHP Code:

if ($postinfo=getpostinfo($postid)) { 

If you comment this line out, you will receive this error:
PHP Code:


Parse error
parse error in /home/blah/public_html/blah/blah/admin/functions.php on line 1907 

so do NOT comment out the line described above.





:)

WebMasterAJ 01-06-2002 06:09 PM

Bringing this hack back, I am using 2.2.0 and when I install the hack, and go to Prune... I tell it to prune 50 days (had the board since Sept) and it comes up with nothing. It doesn't display one post...

However, when I delete threads/posts individually, users keep their post count... so it works on an "individual basis"...

Any ideas?

Thanks...

Andrew Tatum

Jawelin 02-16-2002 09:26 PM

Excuse the intrusion, probably in a wrong place, but nobody answered here

I have the opposite problem: when a mod moves a post/thread from a forum with $countposts=1 to another with $countposts=0 (for example the RecycleBin or a chit-chat area which doesn't count against the membership awards given by post-counter), that number is not decreased.
Infact in postings.php, action move, nowhere is any instruction to decrease the counter (or check if necessary) like it is in the delete thread/post sections.
I don't agree with this policy, but that isn't the problem: infact, if I do a complete post recount, unpredictably this user count remains the same, even that user post is ONLY into the $countposts=0 forum....

What's up ?
Thanks

P.S.: I would like very much to bugfix the 'move' code to do this check, but can't figure how...

ToraTora! 02-17-2002 05:40 AM

you guys should really read this thread from beginning to end. Alot of your questions are answered within it.

Jawelin 02-17-2002 08:17 AM

Quote:

Originally posted by ToraTora!
you guys should really read this thread from beginning to end. Alot of your questions are answered within it.
Are you sure ? Have you carefully read mine ? :china:
Thnx

Neo 03-25-2002 07:40 AM

Yes this is updated.. I remeber the old one that was made *memories*.. but the code has changed. So here it is in living color.

I thought this would be usefull since a few people have asked about it.

##### In admin/function.php find ( around line 1967) #####
PHP Code:

    if (is_array($userpostcount)) {
      while(list(
$postuserid,$subtract)=each($userpostcount)) {
        
$DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");
      }
    } 

### and replace with ###
PHP Code:

//    if (is_array($userpostcount)) {
//      while(list($postuserid,$subtract)=each($userpostcount)) {
//        $DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");
//      }
//    } 

##########

##### now shortly under it find ( around line 1996 ) #####
PHP Code:

    if ($countposts) {
      
$DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
    } 

### and replace with ###
PHP Code:

//    if ($countposts) {
//      $DB_site->query("UPDATE user SET posts=posts-1 WHERE userid='$postinfo[userid]'");
//    } 

##########

Enjoy.

Jawelin 03-25-2002 07:48 AM

Just an add: WHAT ABOUT moved threads ?
I saw the post count of each user isn't updated when I move a thread from a forum (with countposts=1) to another (with countposts=0) ... ???

I also put a message in bugfix section of vb.com, but it doesn't seem being recognized as a bug... :(

How could I recount posts -ONLY- for each members affected by a particular thread ?

Thanks

ZiRu$ 03-26-2002 05:46 AM

work perfectly on 2.2.4

larryz 03-26-2002 07:57 AM

Original Post:

https://vborg.vbsupport.ru/showthrea...threadid=34518

jardragon901 03-28-2002 09:25 AM

thanx neo, works great :) .

Zedd 04-04-2002 07:03 PM

thnax neo that worked easily and fast.


All times are GMT. The time now is 04:44 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.01372 seconds
  • Memory Usage 1,868KB
  • 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
  • (11)bbcode_code_printable
  • (12)bbcode_php_printable
  • (4)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
  • (40)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