Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Mod Name / Version: Decrease Post Count When Post Is Deleted

Description: If a user, admin, or moderator deletes a user's post with the 'Delete this post' button, their post count will decrease by 1.

This prevents people from padding their count by making bogus posts, which either they or an admin/moderator end up deleting afterwards.


Working Under: UBB.Threads 6.3

Mod Status: Finished

Any pre-requisites:

Author(s): Twisty

Date: 08/25/04

Credits:

Files Altered: deletepost.php

New Files:

Database Altered: no

Info/Instructions: In deletepost.php...

CHANGE THIS:

Code
// ----------------------------------------------------------------<br />// Find out if there are any file attachments so we can delete them.<br />   if ($File) {<br />      unlink("{$config['files']}/$File");<br />   }


TO THIS:

Code
// ----------------------------------------------------------------<br />// Find out if there are any file attachments so we can delete them.<br />   if ($File) {<br />      unlink("{$config['files']}/$File");<br />   }<br /><br />   // Hack - Decrease their post count by 1 <br />      $query = "<br />        UPDATE {$config['tbprefix']}Users<br />        SET    U_Totalposts = U_Totalposts - 1,<br />               U_Laston     = '$date'<br />        WHERE  U_Number   = '$Postedby'<br />      ";<br /><br />      $dbh -> do_query($query);



Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Nice.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
Damn, they're on to me!


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,575
Posts293,932
Members13,824
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,835
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)