PM reporting you have a PM, but you don't?
— coRpSEHave you run into an issue with your site is reporting someone has a PM when they actually don't?
Yesterday, my site here, was reporting to someone that they had a PM, but actually didn't. This is not the first time I have come upon this issue. I actually had a report on another site a few weeks ago about it, and a couple of months ago, last year and the year before that a few times as well. Well, I have looked at what is causing the issue, and I am not really sure what is going on. A couple of years ago, I started working on a script that would repair the issue, and I sort of did, but didn't work completely, and I didn't have time to really dig into it and finish it due to surgery, other projects taking over, me forgetting about it, ect...
Well, I finally got off my butt and finished the script. Boy did I learn actually how messed up and bloated the PM system is. If you run into this issue on your site, all you have to do is just download this script, and upload it into the root of your site. Then just go to the URL YourSite.com/pm_repair.php. If there are issues, you will see a report something like this:
Now, if there are no issues to be found, then you will get the message:Everyone is all set. There are no discrepancies with any PM's on this site.
Any questions, feel free to contact coRpSE at evolution-xtreme.co.uk.
What if you are not getting this error and you still run it, will it hurt anything, the answer is no. The way this script works, is as follows. I am going to dumb this a bit.
- Starts a loop through all users, since we are trying to repair anyone that might have this issue. (This is why it can take a few seconds to run).
- Grabs the New PM's and the Unread PM's from the user table. This is where it lies on the PM system which causes you the headache.
- Then grabs a count of how many PM's you should have in the private messages table.
- Now, if first count does not equal the second count, then the system sets the "New PM" column to the true number, and the Unread PM's to zero. The reason it goes to 0, is due to it already putting the correct count into the "New PM". Once you go to your PM's, even if you don't read the PM's, it will move them to the Unread column. (this is the confusing part that I hate about the PM system.
- The first person it should check is user #1, which is Anonymous, and you wouldn't believe how many people have replied to the welcome PM, or PMed it. I believe that has been since addressed and fixed, so you no longer can PM that user, but, if you're like me and have updated the site from the previous version of Evo, then you could. After that, it checks everyone.
I coded this to work with all version from D to F, so those of you that is still running the legacy versions of Evo, this will still work for you.
Any questions, feel free to ask.
I like to thank
for pointing this out to me and the EID clan to always seem to keep getting this issue to finally make me get around to finishing this.
Please login to see this link
Get registered or Log in