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
  #52  
Old 06-11-2002, 07:44 PM
Lesane's Avatar
Lesane Lesane is offline
 
Join Date: Oct 2001
Location: The Netherlands
Posts: 1,149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Tha Rock
Hey can anyone make this hack work with 2.2.6 running the Store hack? I'm about to install the store hack, but i'm stuck on the part where it says this;

------
------------------
find(around line 1897):
------------------

$DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");

------------------
change it to:
------------------

$storeadmin = $DB_site->query_first("SELECT * FROM storeadmin");
$storemin=$storeadmin[newthread];
$DB_site->query("UPDATE user SET posts=posts$subtract,storep=storep-'$storemin' WHERE userid='$postuserid'");

------------------
find(around line 1930):
------------------

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

------------------
Change it to:
------------------

$storeadmin = $DB_site->query_first("SELECT * FROM storeadmin");
$storem=$storeadmin[newreply];
$DB_site->query("UPDATE user SET posts=posts-1,storep=storep-'$storem' WHERE userid='$postinfo[userid]'");
------

That's in functions.php

The problem here is that i've commented out what ToraTora! has said to do.

I don't know any PHP and not this advanced either. So if anyone could re-write those two steps from the Store Hack taking mind that i've commented out what ToraTora! said to do and I still don't want post counts to be reduced during a prune....

If anyone can do that, which i'm sure is Very simple for someone who knows PHP, I will be very grateful
Delete post/thread = Decrease points from user but don't decrease user's posts amount, then do the following:

PHP Code:
------------------------
find(around line 1897):
------------------

$DB_site->query("UPDATE user SET posts=posts$subtract WHERE userid='$postuserid'");

------------------
change it to:
------------------

$storeadmin $DB_site->query_first("SELECT * FROM storeadmin");
$storemin=$storeadmin[newthread];
$DB_site->query("UPDATE user SET storep=storep-'$storemin' WHERE userid='$postuserid'");

------------------
find(around line 1930):
------------------

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

------------------
Change it to:
------------------

$storeadmin $DB_site->query_first("SELECT * FROM storeadmin");
$storem=$storeadmin[newreply];
$DB_site->query("UPDATE user SET storep=storep-'$storem' WHERE userid='$postinfo[userid]'");
------ 
Reply With Quote
  #53  
Old 06-11-2002, 07:54 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[QUOTE]Originally posted by Lesane

Delete post/thread = Decrease points from user but don't decrease user's posts amount, then do the following:

Reply With Quote
  #54  
Old 06-11-2002, 08:12 PM
Lesane's Avatar
Lesane Lesane is offline
 
Join Date: Oct 2001
Location: The Netherlands
Posts: 1,149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hehe, that's no line of code. When you delete a post/thread then the user's post amount won't be decreased but the user's points amount does will be decreased with that code that i posted above.
Reply With Quote
  #55  
Old 06-11-2002, 08:21 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh so I just don't do anything for that line u put there?
Reply With Quote
  #56  
Old 06-18-2002, 03:32 PM
FFMania FFMania is offline
 
Join Date: Mar 2002
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This hack...can't be installed on a clean version of 2.2.6? I can't find most of the code....
Reply With Quote
  #57  
Old 07-22-2002, 01:07 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok i'm back with another problem, i've installed about 35 hacks on my forum, so functions.php has changed A LOT. I just noticed that I haven't done this hack! :-/

But my code has changed, I'll paste it here, please can someone show me what to do so whenver a post is deleted, a thread is deleted, or a forum pruned, post counts do NOT go down, infact I never want postcounts to go down.

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'].",";
      if ($post['attachmentid'] != 0) {
		  $attachmentids .= $post['attachmentid'].",";
      }
      unindexpost($post['postid']);
    }

    if ($attachmentids != '' ) {
      // make sure you don't remove attachments that are already in use!
      $checkattachments=$DB_site->query("SELECT DISTINCT attachmentid FROM post WHERE attachmentid IN ($attachmentids"."0) AND threadid<>'$threadid'");
      $omitattachmentids="";
      while ($omitattach=$DB_site->fetch_array($checkattachments)) {
        $omitattachmentids.=$omitattach['attachmentid'].",";
      }
      $DB_site->query("DELETE FROM attachment WHERE attachmentid IN ($attachmentids"."0) AND NOT attachmentid IN ($omitattachmentids"."0)");
    }

$storeadmin = $DB_site->query_first("SELECT * FROM storeadmin");
$storemin=$storeadmin[newthread];
$DB_site->query("UPDATE user SET storep=storep-'$storemin' WHERE userid='$postuserid'");


    if ($postids!="") {
      $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)) {
$storeadmin = $DB_site->query_first("SELECT * FROM storeadmin");
$storem=$storeadmin[newreply];
$DB_site->query("UPDATE user SET storep=storep-'$storem' WHERE userid='$postinfo[userid]'");
   
   if ($postinfo['attachmentid']) {
			// make sure you don't remove attachments still in use
			$otherattachs=$DB_site->query("SELECT attachmentid FROM post WHERE attachmentid=$postinfo[attachmentid] AND threadid<>'$postinfo[threadid]'");
			if ($DB_site->num_rows($otherattachs)==0) {
				$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 post WHERE postid='$postid'");
  }
}

// ###################### Start make login code #######################
Reply With Quote
  #58  
Old 10-29-2002, 10:42 AM
desi desi is offline
 
Join Date: Jun 2002
Posts: 67
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i got a question guys ... i have the hack working but it only accounts for user posts and not the board posts is there anyway to retain the boards count also ?

its would be really good if thats possible

cheers
Reply With Quote
  #59  
Old 10-29-2002, 02:33 PM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

desi: Give me 5 minutes, I'm releasing a hack for what you want.
Reply With Quote
  #60  
Old 05-11-2003, 09:18 AM
The General's Avatar
The General The General is offline
 
Join Date: Aug 2002
Location: Netherlands
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's 5 long minutes!

Is there a way to retain the board count yet? Bc that would be groovy! =]
Reply With Quote
  #61  
Old 05-11-2003, 09:21 AM
N9ne N9ne is offline
 
Join Date: Feb 2002
Posts: 1,495
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did indeed release the hack a long time ago General .

https://vborg.vbsupport.ru/showthrea...threadid=45158
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:44 AM.


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.08231 seconds
  • Memory Usage 2,328KB
  • 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)bbcode_php
  • (1)bbcode_quote
  • (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
  • (11)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