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)

Lesane 06-11-2002 07:44 PM

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]'");
------ 


N9ne 06-11-2002 07:54 PM

[QUOTE]Originally posted by Lesane

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


Lesane 06-11-2002 08:12 PM

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.

N9ne 06-11-2002 08:21 PM

Oh so I just don't do anything for that line u put there? :confused:

FFMania 06-18-2002 03:32 PM

This hack...can't be installed on a clean version of 2.2.6? I can't find most of the code....:(

N9ne 07-22-2002 01:07 PM

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 #######################


desi 10-29-2002 10:42 AM

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

N9ne 10-29-2002 02:33 PM

desi: Give me 5 minutes, I'm releasing a hack for what you want.

The General 05-11-2003 09:18 AM

That's 5 long minutes! :D

Is there a way to retain the board count yet? Bc that would be groovy! =]

N9ne 05-11-2003 09:21 AM

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

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


All times are GMT. The time now is 05:50 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.01623 seconds
  • Memory Usage 1,760KB
  • 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)bbcode_php_printable
  • (1)bbcode_quote_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