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)

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


All times are GMT. The time now is 06:14 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.01041 seconds
  • Memory Usage 1,742KB
  • 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
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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