Results 1 to 15 of 28
Page 1 of 2
FirstFirst 1 2 ... LastLast

Thread: [Not-even-mini-RELEASE v2] Prune doesn't reduce user post count

  1. #1
    Senior Member tubedogg has disabled reputation tubedogg's Avatar
    Join Date
    Feb 2001
    Location
    Medina, OH
    Age
    28
    Posts
    13,647
    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.
     

  2. #2
    Senior Member conan is on a distinguished road
    Join Date
    Sep 2000
    Posts
    389
    Whoa that's actually pretty good, I wonder if it's possible to do the same with the board's post count?
     

  3. #3
    Senior Member conan is on a distinguished road
    Join Date
    Sep 2000
    Posts
    389
    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?
     

  4. #4
    Senior Member tubedogg has disabled reputation tubedogg's Avatar
    Join Date
    Feb 2001
    Location
    Medina, OH
    Age
    28
    Posts
    13,647
    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.
     

  5. #5
    Senior Member conan is on a distinguished road
    Join Date
    Sep 2000
    Posts
    389
    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!
     

  6. #6
    Senior Member JJR512 is on a distinguished road JJR512's Avatar
    Join Date
    Dec 2000
    Location
    Glen Burnie, MD, USA
    Age
    34
    Posts
    507
    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.
    -Justin "JJR512" Rebbert
    JJR512.com: Chat about anything!
     

  7. #7
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501
    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)
     

  8. #8
    Senior Member Streicher has disabled reputation Streicher's Avatar
    Join Date
    Jan 2001
    Location
    Reinbek, Germany
    Posts
    383
    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"
    Last edited by Streicher; Sun 27th May '01 at 6:45am.
    Streicher
     

  9. #9
    Senior Member JamesUS is on a distinguished road
    Join Date
    Aug 2000
    Location
    London, England
    Posts
    4,625
    bira's version of the hack does work in vB 2.0 final
    If bira's hack works what do you need help with?
    James Ussher-Smith
    .:.: SideLinks - Make your directory work for you :.:.
     

  10. #10
    Senior Member Streicher has disabled reputation Streicher's Avatar
    Join Date
    Jan 2001
    Location
    Reinbek, Germany
    Posts
    383
    Originally posted by JamesUS


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

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

  11. #11
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501
    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"
     

  12. #12
    Senior Member BluSmurf is on a distinguished road BluSmurf's Avatar
    Join Date
    May 2001
    Location
    smurfland
    Age
    32
    Posts
    111
    sorry bira but I've too tried your hack and it didnt work.
     

  13. #13
    Senior Member bira is on a distinguished road bira's Avatar
    Join Date
    May 2000
    Location
    2nd turn left
    Age
    42
    Posts
    1,501
    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
     

  14. #14
    Senior Member Christian is on a distinguished road Christian's Avatar
    Join Date
    Feb 2001
    Location
    wuerzburg.germany.earth
    Age
    32
    Posts
    146
    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
     

  15. #15
    Member Blue2000 is on a distinguished road
    Join Date
    Feb 2001
    Posts
    87
    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]"]--;
    // }
    // }
     

Page 1 of 2
FirstFirst 1 2 ... LastLast

Similar Threads

  1. Replies: 1
    Last Post: Sun 5th May '02, 1:57pm
  2. Bug: If an user at the end doesn't post the poll
    By julius in forum Pre beta 4.1 bugs
    Replies: 2
    Last Post: Wed 2nd May '01, 9:33am
  3. Replies: 5
    Last Post: Thu 8th Mar '01, 8:30pm
  4. Poll-thread -> doesn't count?
    By IgeL in forum Pre beta 4.1 bugs
    Replies: 0
    Last Post: Wed 21st Feb '01, 1:33pm
  5. [fixed] Post Count doesn't Increment
    By JamesUS in forum Pre beta 4.1 bugs
    Replies: 2
    Last Post: Mon 4th Dec '00, 4:05pm

Bookmarks

Posting Permissions

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts