![]() |
Freezing postcounts during board cleanup
Hi guys.
I'm planning to do a cleanup of our forum, however I am hoping there is a way I can 'freeze' the postcounts of all members in the meanwhile... in other words, so they have the same post amounts afterwards, even after mass topics have been deleted from the forum. Basically just want to do a big cleanup without it affecting any post counts at all! Otherwise, with over 1,000 members, it would take too long to restore them manually afterwards. Can anybody please point me in the right direction for a mod which would help with this, or even might be interested in helping me with their own hack/mod for it? Thanks in advance :) |
I have never seen a mod to do this. What you might be able to do is create a new field in the user table and copy the post count to that new field. Then do your maintenance. Then copy the field back to the post counts field.
|
Hi Lynne,
Thanks for your advice. Would this method work effectively for a board with a lot of members ie. can it be done in one hit, via an SQL query or the like? It would it have to be done manually per user (ie. one-by-one)? I'm hoping the first is an option, with the amount of members we have it may take too long to do otherwise. Cheers :) |
I'm pretty sure you can delete to your hearts content and post numbers won't go down so long as you don't perform a "Update Post Counts" in the maintenance section of the admincp.
[But you should probably perform a database backup first! 1. "just in case" and 2. so you have those soon to be deleted posts save for posterity should you need to go back to them.] |
This is a somewhat common request which is virtually impossible to achieve, as there are a million + 1 places where the postcount gets updated.
Even if you did backup and restore the postcount, it would get updated to the real numbers the next time you run the maintenance function. My best advice would be: Don't delete content - or don't care about post counters. |
Quote:
We also have an established post count 'program' where members see it as a big achievement to reach certain post milestones (in fact we have a section specifically where members post about them, and get medals/trophies for it) and we also have postcount restricted areas on our forum too. So we can't really do without the post counters option. I guess I'll have to keep searching in the meanwhile for a way to do this. Quote:
|
Quote:
|
If not, SQL for the win:
Run these before: Code:
CREATE TABLE postcounts ( Code:
UPDATE user |
^^ Adrian wrote out what I was thinking. :)
|
Thanks so much for that, the queries are perfect for what I want to do :)
I do have one more small request though... would there be a similar one for reinstating post/topic counts for the forum stats? Ie. Members: 1,087, Threads: 25,591, Posts: 420,667 Or where would I edit this afterwards to reflect the counts prior to the changes being made? Thanks again SirAdrian, you've been a great help sofar!! PS. Thought I had better note as well in regards to your suggestion Dartho - I did a test and unfortunately postcounts are affected with topic/post deletion, even without touching the maintenance section of the AdminCP! Just to let you know :) I wasn't sure of this beforehand, either. |
Nobody can help me with the last bit? :)
|
Create a new plugin:
Product: vBulletin Hook Location: forumhome_complete Name: Restore ForumHome Stats Execution Order: 5 Plugin PHP Code: Code:
function stripcomma($string){ Code:
$num_deleted_threads =10000; |
Hi Dartho,
Thanks for your help. I followed your instructions and set the following, which were the stats for our forum prior to the board cleanup... Quote:
|
no commas!
BTW - don't put in the totals, put in teh number you deleted. eg. if now (after the clean up) you have 5000 threads and previously you had 25627, then $num_deleted_threads=20627; etc ... |
Quote:
I'll give it a shot now and see how I go, thanks again :) ETA: Ok, I altered the amounts to reflect the deletions: Quote:
|
1 Attachment(s)
I tested on my live site - let me just check that I haven't missed a vital point...
[Edit] Tested and working on my site... I exported teh plugin so it is definately identical - try uploading the attached (disable/delete the one you created manually first) |
Ok I just worked out whats going on :D The default display for our forum stats (ie. at the foot of the forum) is right ie. the plugin is working correctly :) Its the VBAdvanced forum stats box in the left side column thats still wrong :rolleyes:
I don't suppose there is an easy fix to get it working for that too? :) Its not a huge issue if not, I am grateful for your help regardless Dartho :) Just means I'll have to either edit/remove that box, since its not the same! Let me know :) |
You could create another plugin with the same code and put it on
Product: vBadvanved CMPS Hook Location: vba_cmps_module_stats (vbacmps) Title: vBadvanced Stats |
Got it :D Its all fixed!!!
Thank you so much for all your help!!! I really appreciate it :) Our forum is nice and tidy now - and taking up a lot less database space :) Cheers :D ETA: Bugger, spoke too soon... the VBA stats work on all forum pages except for the index page - which goes blank when this plugin is active :S |
All times are GMT. The time now is 08:11 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|