Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by tubedogg tubedogg is offline
Developer Last Online: Dec 2016 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 03-26-2001 Last Update: Never Installs: 45
 
No support by the author.

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.

Show Your Support

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

Comments
  #12  
Old 05-29-2001, 01:07 AM
bira's Avatar
bira bira is offline
 
Join Date: Nov 2001
Posts: 387
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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"
Reply With Quote
  #13  
Old 05-29-2001, 03:33 PM
BluSmurf BluSmurf is offline
 
Join Date: Nov 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry bira but I've too tried your hack and it didnt work.
Reply With Quote
  #14  
Old 05-29-2001, 07:00 PM
bira's Avatar
bira bira is offline
 
Join Date: Nov 2001
Posts: 387
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #15  
Old 06-11-2001, 10:12 AM
Christian Christian is offline
 
Join Date: Nov 2001
Location: wuerzburg.germany.earth
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #16  
Old 06-13-2001, 05:42 PM
Blue2000 Blue2000 is offline
 
Join Date: Oct 2001
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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]"]--;
// }
// }
Reply With Quote
  #17  
Old 06-14-2001, 07:39 AM
MichaelG
Guest
 
Posts: n/a
Default

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
Reply With Quote
  #18  
Old 06-30-2001, 06:01 PM
Dolamite's Avatar
Dolamite Dolamite is offline
 
Join Date: Nov 2001
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #19  
Old 07-21-2001, 03:22 AM
weezle
Guest
 
Posts: n/a
Default

Cant get this hack to work with VBBFinal??? Can someone help me
Reply With Quote
  #20  
Old 07-21-2001, 05:08 AM
TripleH
Guest
 
Posts: n/a
Default

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??
Reply With Quote
  #21  
Old 09-10-2001, 12:23 AM
Christine's Avatar
Christine Christine is offline
 
Join Date: Oct 2001
Location: PA
Posts: 472
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Thanks!!!
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 04:46 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.08978 seconds
  • Memory Usage 2,306KB
  • Queries Executed 25 (?)
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
  • (7)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (8)postbit_onlinestatus
  • (11)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