Welcome, Guest. Please Login or Register.
April 26, 2025, 11:29:26 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Completed mods  |  [Done 1.4.0][CODE] Number of posts correction with RemoveThread.php « previous next »
Pages: [1] 2 Reply Ignore Print
Author Topic: [Done 1.4.0][CODE] Number of posts correction with RemoveThread.php  (Read 3163 times)
sylvester
YaBB God
*****
Posts: 525


[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« on: July 08, 2002, 09:36:38 PM »
Reply with quote

<id>
Number of posts correction with RemoveThread.php
</id>
<version>
1
</version>

<mod info>
If you remove a topic, the number of posts of a member won't decrease. With this mod, it will :)
So, this is a BUGFIX :)
</mod info>

<edit file>
Sources/RemoveThread.php
</edit file>

<search for>
   $row = mysql_fetch_array($request);
</search for>

<add after>
   $request2 = mysql_query("SELECT ID_MEMBER FROM {$db_prefix}messages WHERE ID_TOPIC='$threadid'");
</add after>

<search for>
$request = mysql_query("DELETE FROM {$db_prefix}log_topics WHERE ID_TOPIC=$threadid");
</search for>

<add after>

   while($temp = mysql_fetch_row($request2)) {
      if($temp[0] != '-1') {
         $request = mysql_query("UPDATE {$db_prefix}members SET posts=posts-1 WHERE ID_MEMBER='$temp[0]'");
      }
   }
</add after>
« Last Edit: August 23, 2002, 12:36:10 AM by sylvester » Logged

I'm back
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:[CODE] Number of posts correction with RemoveThread.php
« Reply #1 on: July 08, 2002, 09:38:28 PM »
Reply with quote

It is supposed to that way, this isn't a bug fix. ::)
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
sylvester
YaBB God
*****
Posts: 525


Re:[CODE] Number of posts correction with RemoveThread.php
« Reply #2 on: July 08, 2002, 09:43:34 PM »
Reply with quote

Quote from: Chris Cromer on July 08, 2002, 09:38:28 PMIt is supposed to that way, this isn't a bug fix. ::)

There is no query in RemoveThread.php for {$db_prefix}members, so it can't decrease the number of posts ::) :P
AND....i've tested it out before i made this 'bugfix', otherwise i didn't make this 'bugfix'

RemoveThread.php
<?php
/*****************************************************************************/
/* RemoveThread.php                                                          */
/*****************************************************************************/
/* YaBB: Yet another Bulletin Board                                          */
/* Open-Source Project started by Zef Hemel ([email protected])                 */
/* Software Version: YaBB SE                                                 */
/* ========================================================================= */
/* Software Distributed by:    http://www.yabb.info                          */
/* Support, News, Updates at:  http://www.yabb.info/community                */
/*                             http://yabb.xnull.com/community               */
/* ========================================================================= */
/* Copyright (c) 2001-2002 Lewis Media - All Rights Reserved                 */
/* Software by: The YaBB Development Team                                    */
/*****************************************************************************/
/* This program is free software; you can redistribute it and/or modify it   */
/* under the terms of the GNU General Public License as published by the     */
/* Free Software Foundation; either version 2 of the License, or (at your    */
/* option) any later version.                                                */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* The GNU GPL can be found in gpl.txt in this directory                     */
/*****************************************************************************/

$removethreadplver="YaBB SE 1.4.0";

function 
RemoveThread2 () {
   global $username,$moderators,$settings,$modSettings,$txt,$cgi,$yySetLocation,$currentboard,$cgi,$threadid,$db_prefix;
   if (!(in_array($username,$moderators) &#124;&#124; $settings[7]=='Administrator' &#124;&#124; $settings[7]=='Global Moderator'))
      fatal_error("$txt[73]");
  
    
//Lines 38-45 all there to delete attachments on thread deletion - Jeff
    
$request mysql_query("SELECT attachmentFilename FROM {$db_prefix}messages WHERE (ID_TOPIC=$threadid AND attachmentFilename<>NULL)");

    if (
mysql_num_rows($request)>0){
       while($row mysql_fetch_array($request)){
        unlink($modSettings['attachmentUploadDir'] . "/" $row['attachmentFilename']);
      }
   }

   $request mysql_query("SELECT ID_BOARD,numReplies,ID_POLL FROM {$db_prefix}topics WHERE ID_TOPIC=$threadid");
   $row mysql_fetch_array($request);
   $request mysql_query("DELETE FROM {$db_prefix}polls WHERE ID_POLL='$row[ID_POLL]' LIMIT 1");
   $row['numReplies']++;
   $request mysql_query("UPDATE {$db_prefix}boards SET numTopics=numTopics-1,numPosts=numPosts-$row[numReplies] WHERE ID_BOARD=$row[ID_BOARD]");
   $request mysql_query("DELETE FROM {$db_prefix}topics WHERE ID_TOPIC=$threadid");
   $request mysql_query("DELETE FROM {$db_prefix}messages WHERE ID_TOPIC=$threadid");
   $request mysql_query("DELETE FROM {$db_prefix}calendar WHERE id_topic=$threadid");
   $request mysql_query("DELETE FROM {$db_prefix}log_topics WHERE ID_TOPIC=$threadid");

   $yySetLocation "$cgi";
   redirectexit();
}

?>

« Last Edit: July 08, 2002, 10:05:34 PM by sylvester » Logged

I'm back
Chris Cromer
The Strange One
Mod Team
YaBB God
*****
Posts: 3152


I am just a figment of your imagination.

WWW
Re:[CODE] Number of posts correction with RemoveThread.php
« Reply #3 on: July 09, 2002, 12:15:02 AM »
Reply with quote

QuoteThere is no query in RemoveThread.php for {$db_prefix}members, so it can't decrease the number of posts  

Well I thought that you made it do that, from the sound of the topic and what you wrote, sorry about the missunderstanding.
Logged

Chris Cromer

I am not suffering from insanity, I am enjoying every minute of it.
Stud Muffin
Full Member
***
Posts: 120


Oh baby!!

WWW
Re:[CODE] Number of posts correction with RemoveThread.php
« Reply #4 on: August 17, 2002, 03:19:26 AM »
Reply with quote

Is this still needed for 1.4.1 ?
Logged

Thanks to all the YaBBSE team, a great forum :)
OAP clan Forum
sylvester
YaBB God
*****
Posts: 525


Re:[CODE] Number of posts correction with RemoveThread.php
« Reply #5 on: August 23, 2002, 12:35:05 AM »
Reply with quote

Quote from: Stud Muffin on August 17, 2002, 03:19:26 AMIs this still needed for 1.4.1 ?
yes
Logged

I'm back
Jeff Lewis
Global Moderator
YaBB God
*****
Posts: 10149


I'm a llama!

WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #6 on: August 23, 2002, 11:37:30 AM »
Reply with quote

It is NOT a bug fix. RemoveThreads was designed this way so peoples post counts are messed over when cleaning up old posts.
Logged

sylvester
YaBB God
*****
Posts: 525


Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #7 on: August 23, 2002, 12:06:35 PM »
Reply with quote

Quote from: Jeff Lewis on August 23, 2002, 11:37:30 AMIt is NOT a bug fix. RemoveThreads was designed this way so peoples post counts are messed over when cleaning up old posts.
Oh, sorry Jeff :-[ :P
Logged

I'm back
Zayexi Hayati
Noobie
*
Posts: 25


Making this forum better one post at a time.

WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #8 on: March 01, 2003, 06:43:39 AM »
Reply with quote

So is there a way to not reduce the number of posts a member has when deleting a post?
Logged

The important thing is not to stop questioning.
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #9 on: March 01, 2003, 06:58:32 AM »
Reply with quote

If you delete a thread, it decreases the post count over members with this mod.  Otherwise it does not.

Deleting a single post, however, always decreases the post count.  If this is not the desired effect, you can edit their profile and raise it.... but... normally you only delete a single post because it should not have been posted.

Could someone split this and move to Administration Help?

-[Unknown]
Logged
Zayexi Hayati
Noobie
*
Posts: 25


Making this forum better one post at a time.

WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #10 on: March 01, 2003, 07:33:15 AM »
Reply with quote

Actually I tested it and when I deleted a single post it takes one away from the post count

I then tried it on a whole topic and it also reduced the number of posts for the members who had posted.

I am using Version 1.5.1 So was it something that was added to the new version?
Logged

The important thing is not to stop questioning.
Webby
Beta Tester
YaBB God
*****
Posts: 829


Some mistakes are too funny to make only once.

ICQ - 9814812webby@salesplaza.nl WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #11 on: March 02, 2003, 08:39:00 PM »
Reply with quote

Ok, whenever we decide to "clean up" our board, our GM's will remove old topics and threads.

The result is, that people see their postcount decreasing by xx posts.

I think this shouldn't happen, because they actually DID post the topics.

So wouldn't it be better to let the postcount be what it was before deleting the topic / thread ?

Also : where can I change the code to "fix" this on my board ?

I use v1.5.1Rc38

Thanx in advance ;)
Logged

Webby of salesplaza.nl
The YaBBSE buttongenerator : Click HERE !
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #12 on: March 02, 2003, 08:43:33 PM »
Reply with quote

To disable this, remove the following lines from RemoveThreads.php:

   while ($temp = mysql_fetch_row($request2))
      if ($temp[0] != -1)
         $request = mysql_query("
            UPDATE {$db_prefix}members
            SET posts=posts-1
            WHERE ID_MEMBER='$temp[0]';") or database_error(__FILE__, __LINE__);


And also (this isn't important...) these:
   $request2 = mysql_query("
      SELECT ID_MEMBER
      FROM {$db_prefix}messages
      WHERE ID_TOPIC='$threadid';") or database_error(__FILE__, __LINE__);


Question:  Which do people prefer?  I always thought it was still the old way - and liked the old way too.

-[Unknown]
Logged
Webby
Beta Tester
YaBB God
*****
Posts: 829


Some mistakes are too funny to make only once.

ICQ - 9814812webby@salesplaza.nl WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #13 on: March 02, 2003, 08:47:37 PM »
Reply with quote

Thanx.

I prefer this way :

When I post 10 topics, and an admin or GM decides to delete 2, I still have posted 10 topics and not 8.

Ok, when somebody wants to "score" topics, you can always decide to decrease the postcount of this member to show him a lesson, but this is my opinion (and also of my members).
Logged

Webby of salesplaza.nl
The YaBBSE buttongenerator : Click HERE !
David
Destroyer Dave
Global Moderator
YaBB God
*****
Posts: 5761


I'm not a llama!

WWW
Re:[Done 1.4.0][CODE] Number of posts correction with RemoveThread.php
« Reply #14 on: March 02, 2003, 08:53:49 PM »
Reply with quote

I think if you delete an individual post the members count should go down.  If you delete an entire thread, it should not decrease.  If you remove old topics it should not decrease.  If you delete a board it should not decrease.
Logged

Pages: [1] 2 Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [Done 1.4.0][CODE] Number of posts correction with RemoveThread.php « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.016 seconds with 16 queries.