PDA

View Full Version : how to auto delete pms older then x time?


MistViper
03-02-2015, 05:15 PM
Its to prevent members their inbox from getting full and not emptying themselves.

So I'm looking for some sort of automation tool that will delete messages from users who don't empty their own inbox.

Maybe only when their inbox is full or in general when their message is older then x time.

How could I set that up? I tried to find a setting for this in the ACP but couldn't find anything.

Is there a plugin for it?

kh99
03-02-2015, 06:10 PM
A plugin wouldn't be difficult. It just needs to execute one query, and you could put it on one of the cleanup hooks. But I hesitate to post code that deletes from the database without a chance to do at least a little testing, and I can't do that right now.

MistViper
03-02-2015, 06:21 PM
A plugin wouldn't be difficult. It just needs to execute one query, and you could put it on one of the cleanup hooks. But I hesitate to post code that deletes from the database without a chance to do at least a little testing, and I can't do that right now.

Take your time.

Just need a query that deletes PM's from send and inbox that are older then x days.


Also I just need clear and understandble instructions on how to add the code.


A small plugin import file would be ideal ofc

John Lester
03-02-2015, 09:03 PM
I'm not able to confirm this right now, but I thought there was an option in the acp through the query area to clear out old pms.

kh99
03-02-2015, 09:15 PM
It's possible. I'm always forgetting about something in there. But I looked and couldn't find anything except the ability to delete all of a user's PMs.

MistViper
03-02-2015, 09:33 PM
So that means its not possible to do it?

kh99
03-02-2015, 09:38 PM
No, I just meant that I couldn't find an existing way to do it in the admincp either. But even if there is one, that wouldn't make it happen automatically (assuming that's what you meant).

MistViper
03-02-2015, 10:00 PM
So what is the next step then? To achieve what I want.

kh99
03-02-2015, 10:06 PM
Oh, well, I was going to try to find time to test it, and maybe make it in to a product with options and everything. Because it takes some time to set up a test and make fake PMs, and probably adjust the timestamps to look old, etc. I guess maybe I wasn't clear, when I said I didn't have time right now, I meant I wouldn't today.

MistViper
03-02-2015, 10:12 PM
That is fine I got time. I think others might have a use for this to.

Its good to know you plan on doing this though.


Say in a month do you think it should be ready by then? Or is it hard to give an estimate on this?

Once again thank you, can't express my gratitude enough if I haven't done so already. :)

kh99
03-02-2015, 11:33 PM
I was thinking more like sometime this week. But I have to admit that I often don't get to thigs as soon as I'd like.

ForceHSS
03-03-2015, 12:10 AM
If ozzy was here he would of made a plugin for you

kh99
03-03-2015, 01:55 AM
If ozzy was here he would of made a plugin for you

He is here, he's just choosing not to do anything, so I don't see your point.

ForceHSS
03-03-2015, 01:56 AM
He is here, he's just choosing not to do anything, so I don't see your point.
Might be best to keep that info private

kh99
03-03-2015, 02:44 AM
That is fine I got time. I think others might have a use for this to.

Its good to know you plan on doing this though.


I see you found a DBTech mod that seems to have that feature. Are you going to go with that?

MistViper
03-03-2015, 08:26 AM
I see you found a DBTech mod that seems to have that feature. Are you going to go with that?

I'd prefer not to. Because of the many features we don't need in that plugin.

It is a great plugin, no doubt in that but the 3 links we need to have present in the footer make it far less appealing.


So I would choose your way.

kh99
03-03-2015, 10:38 AM
Yeah, I know what you mean. OK, then I'll do it. Just thought I'd check.

ozzy47
03-04-2015, 09:26 PM
You can get a mod that does this here, http://ozzmodz.com/showthread.php/7210 works on vB4 and vB3.8

kh99
03-04-2015, 10:14 PM
I'd prefer not to. Because of the many features we don't need in that plugin.

It is a great plugin, no doubt in that but the 3 links we need to have present in the footer make it far less appealing.


So I would choose your way.

Well, since I wasn't given the courtesy of being told someone else was working on it after I said I would do it, I'm mostly done mine, so I'm going to finish it and release it here anyway. But if you want to use ozzy's I understand.

MistViper
03-05-2015, 11:12 PM
Well, since I wasn't given the courtesy of being told someone else was working on it after I said I would do it, I'm mostly done mine, so I'm going to finish it and release it here anyway. But if you want to use ozzy's I understand.

Do proceed. I will try yours out to. :) See which one fits my needs best. :up:

But I'm surprised the attention this request gets. That someone else has also made a mod or from what I read released code Ozzy wrote himself for DBTech.

kh99
03-05-2015, 11:25 PM
Yeah, it goes that way sometimes. You either get no response or more than one. But it's OK, mine's going to have a few different features, and I've looked in to some interesting things while working on it.

TheLastSuperman
03-07-2015, 01:43 AM
Dang, meant to reply to this the other night then my youngest ran into the room with a toy to fix (Barbies head was off) and the rest is history as they say UNTIL now :p.

Release yours Kevin, will be nice to see other features but for those of you curious this already existed: https://vborg.vbsupport.ru/showthread.php?t=179879

^ Link taken directly from: https://vborg.vbsupport.ru/showthread.php?t=269719 and remember to check the other 3.x mods out that work for 4.x too some of them are quite nice.

MistViper
03-08-2015, 09:54 AM
Dang, meant to reply to this the other night then my youngest ran into the room with a toy to fix (Barbies head was off) and the rest is history as they say UNTIL now :p.

Release yours Kevin, will be nice to see other features but for those of you curious this already existed: https://vborg.vbsupport.ru/showthread.php?t=179879

^ Link taken directly from: https://vborg.vbsupport.ru/showthread.php?t=269719 and remember to check the other 3.x mods out that work for 4.x too some of them are quite nice.


Looks very old and it isn't always easy to tell when a 3.x mod works for 4.x or not.

But thank you for sharing it here.

TheLastSuperman
03-08-2015, 05:24 PM
Looks very old and it isn't always easy to tell when a 3.x mod works for 4.x or not.

But thank you for sharing it here.

Works just fine, also so you know Joe put together this thread - https://vborg.vbsupport.ru/showthread.php?t=269719 and has then added mods over time that community members have tested and reported working on 4.x ;).

MistViper
03-12-2015, 05:03 PM
How is the progress going @kh99?

kh99
03-12-2015, 05:33 PM
How is the progress going @kh99?

Oh, well, to be honest there hasn't been a lot since I figured you'd end up going with one of the others. But I haven't forgotten about it. In fact I have a few other features including 'prune only if x% full' that you mentioned.

Oh, BTW, is the ability to prune only certain folders important? I see a few of the others have that, but I hadn't thought about it.

MistViper
03-13-2015, 11:17 AM
Oh, well, to be honest there hasn't been a lot since I figured you'd end up going with one of the others. But I haven't forgotten about it. In fact I have a few other features including 'prune only if x% full' that you mentioned.

Oh, BTW, is the ability to prune only certain folders important? I see a few of the others have that, but I hadn't thought about it.


Well no I was waiting on yours. Truly. I plan to use your mod.

Well if you have an important folder made with certain PM's in it you don't want deleted I think so yeah.

Very important to choose what folders like send and inbox folder get cleaned up if getting filled up to 80% for example or just when they are full.

Maybe it would be a good idea not to shock the user by just cleaning out 50% of the oldest PM's or so. Not the whole inbox and send out box. And repeat this process in a cron job.

So the ability to choose what folders gets cleaned is important. Now I don't know how you plan to handle this though as a user can create some custom folders and store PM's in that to.

So how could we handle that?

kh99
03-13-2015, 11:25 AM
Well no I was waiting on yours. Truly. I plan to use your mod.

Well if you have an important folder made with certain PM's in it you don't want deleted I think so yeah.

Very important to choose what folders like send and inbox folder get cleaned up if getting filled up to 80% for example or just when they are full.

Maybe it would be a good idea not to shock the user by just cleaning out 50% of the oldest PM's or so. Not the whole inbox and send out box. And repeat this process in a cron job.


Hmm...so are you saying it should only ever clear out inbox and sent, or you want each user to be able to choose whether or not to prune a folder? The first one I could do, the second one I don't think I'd want to get in to (not to mention the fact that users probably don't want anything pruned anyway, if given a choice).

And are you also sayng the percentage should apply to each folder separately?

MistViper
03-13-2015, 11:30 AM
Hmm...so are you saying it should only ever clear out inbox and sent, or you want each user to be able to choose whether or not to prune a folder? The first one I could do, the second one I don't think I'd want to get in to (not to mention the fact that users probably don't want anything pruned anyway, if given a choice).

And are you also sayng the percentage should apply to each folder separately?

send out: 80% cleaned out oldest first

inbox: 50% cleaned out oldest first

custom made folders only cleared out if full - < 90% for 50% like inbox oldest first.


could that work?

kh99
03-13-2015, 11:32 AM
send out: 80% cleaned out oldest first

inbox: 50% cleaned out oldest first

custom made folders only cleared out if full - < 90% for 50% like inbox oldest first.


could that work?

Sure. I can make each of those percentages configurable.

MistViper
03-13-2015, 11:41 AM
Sure. I can make each of those percentages configurable.

That would probably be even better, let the user aka admin choose how much is cleared out for inbox, send out and custom folders and when. Weekly, monthly or run only when the percentage is hit.

Just thinking out load. I'm sure you know how to make this mod perfect.

kh99
03-13-2015, 11:45 AM
That would probably be even better, let the user aka admin choose how much is cleared out for inbox, send out and custom folders and when. Weekly, monthly or run only when the percentage is hit.

Just thinking out load. I'm sure you know how to make this mod perfect.

lol, thanks, but it's never perfect. No matter how many options I put in, someone will eventually want it to do something else. So right now I'll settle for having it do what you want (or most of it anyay), since you asked for it.

MistViper
03-13-2015, 11:58 AM
lol, thanks, but it's never perfect. No matter how many options I put in, someone will eventually want it to do something else. So right now I'll settle for having it do what you want (or most of it anyay), since you asked for it.

Sounds great. How much % is done of the mod already? And what is the estimated ETA?

Just curious that is all.

kh99
03-13-2015, 12:15 PM
Well, I found out pretty quickly that it wasn't quite the one query that I thought at first, because the users' pm counts have to be updated. Also, adding options like the %quota and excluding certain groups complicated things. So I'd say I was maybe 80% done the basics, but the total % done will depend on what features I try to include. As for ETA, I have to admit that I haven't done any vb stuff in about a week, other than trying to help out on the forum, so it's hard to predict. Hopefully within the next week (I know, that's what I said last time :) )

Anyway, thanks for being patient. I realize that, while I'm sure it's not critical, you don't want to wait months.

MistViper
03-13-2015, 01:35 PM
Well, I found out pretty quickly that it wasn't quite the one query that I thought at first, because the users' pm counts have to be updated. Also, adding options like the %quota and excluding certain groups complicated things. So I'd say I was maybe 80% done the basics, but the total % done will depend on what features I try to include. As for ETA, I have to admit that I haven't done any vb stuff in about a week, other than trying to help out on the forum, so it's hard to predict. Hopefully within the next week (I know, that's what I said last time :) )

Anyway, thanks for being patient. I realize that, while I'm sure it's not critical, you don't want to wait months.

Yeah two weeks at best would be great. Also making this for vb 4.2.2 or?

kh99
03-13-2015, 01:42 PM
Yeah two weeks at best would be great. Also making this for vb 4.2.2 or?

Yeah, I'm working with the latest (4.2.2PL4), but it will probably end up working with any version (including vb3).

MistViper
03-24-2015, 10:44 PM
Yeah, I'm working with the latest (4.2.2PL4), but it will probably end up working with any version (including vb3).

Have you made any progress?

kh99
03-25-2015, 10:53 AM
No, sorry, and it's been two weeks, so if you give up I understand. This is still on my list though. It's more than half done so I will be finishing it. Maybe I'll look at it today.