The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Utility to update pmtotal and pmunread in user table Details »» | |||||||||||||||||||||||||||
Utility to update pmtotal and pmunread in user table
Developer Last Online: Aug 2020
About this Script:
This script will update the PM Count and Undead PM counts in the user table. Why Did I write this: Well, I wrote it as I could not find a built in function in vBulletin to rebuild these values! I had my PM table become corrupted during an install process and while it was easy to restore the PM tables (there are three of them) I had issues as the USER table did not accurately represent the values in the PM table. I tried searching for a solution and I learned that others have had this issue with board imports, pruning old PMs, or as in my case when it was necessary to recover data from a backup. What does the script do: This script updates the USER table to show the correct count of TOTAL PMs and UNREAD PMs for all users. Why is this so "unrefined"? This is intended as a utility. I included a permissions check to verify the person running the script is an Admin. I would suggest that this is not a script that you would want sitting on your server all the time but instead is being shared as a tool for cases where someone needs it! Credits and Revisions 9-Feb-2007 Version 2 thincom2000 did a major rewrite of the script to go from three SQL queries down to one. The script is much faster now and he is listed as Co-author! THANKS! 9-Feb-2007 Version 3 Fixed this bug: https://vborg.vbsupport.ru/showpost....4&postcount=11 Supporters / CoAuthors Show Your Support
|
Comments |
#2
|
||||
|
||||
Thanks, but this Script isn't good for the Performance. Up to 2 Queries per User. For bigger forums this could be a problem
Thanks for Sharing Greeting Surviver |
#3
|
|||
|
|||
Yea, I assume you would only run this if you had a major meltdown...
I tried to get the join syntax right but odds are i would only need to run this script once so it was not worth the time for me at this point... If vBulletin was to build this function in to vBulletin, then it would be worth their time to optomize this! EDIT - Funny, I get one TERRIBLE vote... This is not posted for something people will install and run every day... this is posted here in case you need to import users, merge forums, or your data gets corrupted and you need to FIX your database so your PM counts and count of unread messages is correct... If someone needed this I bet they would be glad I bothered to share the code.... |
#4
|
|||
|
|||
Thanks, I could have used this a couple weeks ago after merging a forum with my current one. But, the problem somehow fixed itself... :P
Sorry to hear that someone gave you a terrible rating. |
#5
|
||||
|
||||
Thank you. I had a PM spammer on my site and I manually went into the DB to delete their PMs... so the PM counts were screwed up.
Thank you thank you! |
#6
|
|||
|
|||
Hm... I could join those first three queries for you if you so desire.
In fact I already did. Your new countupdate.php should be the following: PHP Code:
|
#7
|
|||
|
|||
Quote:
Well, not quite... I tested and this generates an error... Database error in vBulletin 3.6.4: Invalid SQL: SELECT user.userid, user.pmtotal, user.pmunread, pm.pmunread AS pmsunread, pm.pmid FROM user AS user LEFT JOIN pm AS pm ON(pm.userid = user.userid) WHERE user.userid != 0 ORDER BY user.userid ASC; MySQL Error : Unknown column 'pm.pmunread' in 'field list' Error Number : 1054 Date : Thursday, February 8th 2007 @ 09:11:45 PM Script :htt p://www.XXXXXXX.com/forums/countupdate.php Referrer : IP Address : 72.94.246.202 Username : Quarterbore Classname : vb_database I am trying to find the issue byt MYSQL is not my strong point. EDIT - This is why I did the simple code I did... even with my MYSQL manuals I can not fix this... I need some sleep but thanks for the kindness... I just had a rough 24-hrs of bringing back a crashed forum and too little sleep... |
#8
|
|||
|
|||
Ah, I should have checked the PM table before writing that . It's not pmunread but messageread. That will require a slight code modification, but you shouldn't get a database error with this:
PHP Code:
|
#9
|
|||
|
|||
Looks like you still had one error in the query (you have query-First) but with that changed the script works great and much faster then the code I had uploaded...
I am adding you as a co-author... Thanks for the advise and improvement! I am uploading the updated version now! |
#10
|
||||
|
||||
The new version messed up the count total. I'm getting pmtotal of 1, and 0 unread.. for all users.
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|