Previous Thread
Next Thread
Print Thread
Rating: 5
Joined: Oct 2002
Posts: 105
ehm
Offline
Journeyman
Journeyman
Offline
Joined: Oct 2002
Posts: 105
I try the search first, since I guess it would be a comom issue, but find notthing, so there it is:
I deleted posts from members time to time, and I would like to recound the number of post for all members on a UBB Trhead 6.3.
Is that possible? I was thinking in some kind of command line at the SQL windown under ADMIN who could do it.

What happens is I had a police that post like "me too", "thank you", "see you", and other similars should not count to the post numbers, so what I do is delete those (it's a pain, but worth).
Then I just finished deleting all those 'No practical content' posts and now I would like to reclassify all my users.
This is why I would like to have a SQL query to change the post counts on all members.

Thank you for any input.
Elton

Sponsored Links
Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
This is for the total number of posts for each forum though. What he wants is the total number of posts for each user.

This wouldn't be too hard to write though.

Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
what happens when you purge older posts? then a user post count would drop also ???

so basically would would be Changing UBB's "POST COUNT HISTORY" to "CURRENTLY ACTIVE POSTS"


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Yes, currently exisiting posts in the database.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I had to do this quite a while back - used a simple little script like this:

Code
<br /><?<br />// Written by Joshua Pettit<br />// ©2003 - JoshuaPettit.com<br />// www.joshuapettit.com<br />// Used on conceivingconcepts.com<br /><br /><br />// Require the Library<br />	require ("main.inc.php");<br />	<br />echo "Begining the Script to fix the post counts.<br /><br />";<br />$count = 0;<br /><br />$query = "<br />	SELECT U_Username<br />	FROM {$config['tbprefix']}Users<br />	";<br />   $sth = $dbh -> do_query($query);<br /><br />while (list($Username) = $dbh -> fetch_array($sth)) {<br />	$Username_q = addslashes($Username);<br />	$query = "<br />		SELECT COUNT(*)<br />		FROM {$config['tbprefix']}Posts<br />		WHERE B_Username = '$Username_q'<br />	";	<br />   $sti = $dbh -> do_query($query);<br />   $postcount = $dbh -> fetch_array($sti);<br /><br /><br /><br />	$query = "<br />		UPDATE {$config['tbprefix']}Users<br />		SET U_Totalposts = '$postcount[0]'<br />		WHERE U_Username = '$Username_q'<br />	";	<br />   $stj = $dbh -> do_query($query);<br /><br /><br />	echo "$Username updated with $postcount[0] posts.<br />";<br /><br />	$count++;<br />}<br /><br />echo "Done! Updated $count Users!<br />";<br /><br />?>		


Drop that in the threads directory - run it, it'll fix all the post counts. Be sure to remove it when you're done - it's high load to recalculate all the post counts.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Whoops strike that that was an old wwwthreads board - before the advent of U_Number - this will be more efficient on modern boards.

Code
<br /><?<br />// Written by Joshua Pettit<br />// ©2003 - JoshuaPettit.com<br />// www.joshuapettit.com<br /><br /><br />// Require the Library<br />	require ("main.inc.php");<br />	<br />echo "Begining the Script to fix the post counts.<br /><br />";<br />$count = 0;<br /><br />$query = "<br />	SELECT U_Number,U_Username,U_Totalposts<br />	FROM {$config['tbprefix']}Users<br />	";<br />   $sth = $dbh -> do_query($query);<br /><br />while (list($Usernumber,$Username,$oldcount) = $dbh -> fetch_array($sth)) {<br />	$Usernumber_q = addslashes($Usernumber);<br />	$query = "<br />		SELECT COUNT(*)<br />		FROM {$config['tbprefix']}Posts<br />		WHERE B_PosterId = '$Usernumber_q'<br />	";	<br />   $sti = $dbh -> do_query($query);<br />   $postcount = $dbh -> fetch_array($sti);<br /><br /><br /><br />	$query = "<br />		UPDATE {$config['tbprefix']}Users<br />		SET U_Totalposts = '$postcount[0]'<br />		WHERE U_Number = '$Usernumber_q'<br />	";	<br />   $stj = $dbh -> do_query($query);<br /><br /><br />	echo "$Username had $oldcount updated to $postcount[0] posts.<br />";<br /><br />	$count++;<br />}<br /><br />echo "Done! Updated $count Users!<br />";<br /><br />?>		

Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
thanks for the script - worked like a Charm!

I had been looking through the modifications forum for this script for a few days now - I only just now found this in the "how do I" forum. Any possibility of creating this into a file and moving it to the completed mods forum as a USE AT YOUR OWN RISK (as usual) script?

Again - thank you very much for providing exactly what what needed to help many other people (and myself) again


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Joined: Feb 2005
Posts: 9
Lurker
Lurker
Offline
Joined: Feb 2005
Posts: 9
Hey Josh, would that code work for Infopop Threads 6.03?

Where do I do it in my control panel, the update.config settings or MySQL?

Let's say I have a person named Romy constantly screaming at me about his post count wasnt trasnferred.

Username: Romy
Current Postcount: 174 posts
Postcount should be: 17,850 posts.

How would your code look with those settings?

Any help would be appreciated because I got a few posters I need to fix..

1st post in these forums but it won't be the last.


DarkJedi

"Silly Earthlings...Morbo will Destroy You!!!

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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
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,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)