PDA

View Full Version : Administrative and Maintenance Tools - Users Cleanup


Vitaly
06-15-2010, 10:00 PM
3.8 version repost. The same code.

This mod helps to automatically delete user account upon custom-defined rules. For example, you can delete members, who didn't comfirmed emails after 3 days, delete members, who have zero posts and didn't visited your forum for a long time, and so on.

Any conditions can be defined! Cleanup can be done in both automatic and manual mode.

Difference between built-in vB user pruner:

1. Completely automated.
2. Comfotable management of multiple rules.
3. More flexible prune criterias.

Some stat for my forum (only zero-posts users were cleared):

- last user ID 50652
- total users left 19359

60% effectivity!!!

Installation:

Upload files and import product XML.

Configuration:
Enter ACP and go to Users -> Cleanup.
Create cleanup rules you needs, and save in inactive state.
Test you rules. Do manual cleanup, if you wish.

Activate rules (enable automatic cleanup), if you are satisfied with testing results.Warning! Don't activate cleanup rules without testing! Don't forget to backup your forum database!

PS. Product is marked as beta, because i can't test all possible rules combinations. But those been used - works fine. If you have strange results duging testing, don't hesitate to post screenshot with your rule, and explain what is wrong.

Was NOT tested with 3.6.x & 3.7.x, but probably works.

This mod is delelopped here http://github.com/rcdesign/vb-users_cleanup . Patches are welcome.

History:

0.4
- Fixed SQL queries for some conditions (thnks to phr4nk13)

0.3
- compleete code rafactoring
- removed deletet posts count as useless
- added support for blogs & social groups

(!) For upgraders - your cleanup rule swill be disabled! Plese, recheck & enable again.

Marek58
06-16-2010, 08:26 AM
Polish version

gwerzal
06-16-2010, 10:16 AM
Could be very useful for one of my sites.

Thank you.

BozzaJos
06-16-2010, 10:22 AM
Tagged for future use, thanks for the hard work!

tornado88
06-30-2010, 12:07 PM
Worked for me... did exactly what it said it would do.

I only used the test and manual delete function....

Maybe later, I'll try the cron enabled function.

In any case - thanks for the handy utility!

cobaku
07-13-2010, 02:26 PM
it works
thank you

Vitaly
03-21-2011, 10:32 AM
Code is completely refactored to make it clear & more effective. Blogs & SG support added.

After upgrade your previous rules wil be disabled. Please, check those manually & enable again.

BadgerDog
03-21-2011, 01:10 PM
Installed with thanks for testing on 4.04 .... :)

We'd like to use it to clear out any users "Awaiting Email Confirmation" user group who haven't responded to validation email in 14 days or more ...

Regards,
Doug

phr4nk13
03-21-2011, 04:57 PM
That'S exatly what i've searched for. Thanks.

But I gat a SQL/database-error with it when selecting "User has never posted (also count in social groups and blogs)" and test this option.


With my little SQL knowlegde and some Try and Error this function_users_cleanup.php (attachment) is working i think. Anyway please chekc my changes if there are any security mistakes.

Is there a chance to include custom profilefields in the options?

Using vBulletin Suite 4.1.2. German

Sorry for my bad english :)

Vitaly
03-21-2011, 05:44 PM
Thanks for your help. Could you tell full text of SQL error?

May be, problem can be with scopes, but "never posted" condition works at my forum. Can't accept your patch into mainline, because you removed table prefix - that will not be compatible with all installations. But i'll try to do somerthing, if you tell me more info about error. Please, tell me also your SQL version & exact selections set in your cleanup rule, that cause problems.

phr4nk13
03-21-2011, 06:30 PM
I didn't remove the table prefix, i added it. That ist the errormessage onli with this option "User has never posted (also count in social groups and blogs)" selectet and clicked on "test":


Datenbankfehler in vBulletin 4.1.2:

Invalid SQL:
SELECT
`user`.*
FROM
vb_user AS user
LEFT JOIN vb_groupmessage ON `groupmessage`.postuserid = `user`.userid
LEFT JOIN vb_blog_text ON `blog_text`.bloguserid = `user`.userid
WHERE
`user`.`posts` = 0 AND `groupmessage`.gmid IS NULL AND `blog_text`.blogtextid IS NULL AND `user`.`userid` NOT IN (0);

MySQL-Fehler : Unknown column 'groupmessage.gmid' in 'where clause'
Fehler-Nr. : 1054
Fehler-Zeit : Monday, 21.03.2011 @ 20:23:28
Datum : Monday, 21.03.2011 @ 20:23:28
Skript : vbroot/admincp/users_cleanup.php?do=test
Referrer : vbroot/admincp/users_cleanup.php?do=add
IP-Adresse : xXx
Benutzername : xXx
Klassenname : vB_Database
MySQL-Version : 5.1.43-nmm4-log

I was first trying to hardcode the prefix. Than i got the variable to work.

That are the only lines i changed:

// social groups
$join[] = 'LEFT JOIN ' . TABLE_PREFIX . 'groupmessage ON ' . TABLE_PREFIX .'groupmessage.postuserid = `user`.userid';
$where[] = TABLE_PREFIX .'groupmessage.gmid IS NULL';

// blog
if ($vbulletin->products['vbblog'])
{
$join[] = 'LEFT JOIN ' . TABLE_PREFIX . 'blog_text ON ' . TABLE_PREFIX .'blog_text.bloguserid = `user`.userid';
$where[] = TABLE_PREFIX .'blog_text.blogtextid IS NULL';
}
break;

BadgerDog
03-21-2011, 06:36 PM
Does the last few posts mean there's a problem with the mod and we should put it's use on hold for now? :confused:

Thanks ... :)

Regards,
Doug

phr4nk13
03-21-2011, 06:44 PM
Thats only a problem at my installation (atm) and the last option selected. If you push "test" you can try it yourself. All other options working fine for me.

Vitaly
03-21-2011, 07:05 PM
Thanks again for your efforts. Try 0.4 updated version.

phr4nk13
03-21-2011, 07:14 PM
Yay it works. Thanks :)

And now my question from above: Is there a chance to include custom profilefields in the options?

Vitaly
03-21-2011, 07:23 PM
Chances are a bit less than zero :) . But if you could explain, why this required for my progect, or at least to hundreds of vborg visitors - somerthing can change.

combs
03-23-2011, 02:22 PM
OK...this is a lifesaver...great plugin! I had about 100K in posts and pruning would just cause time out. so I used this and was able to prune users by certain post counts. If the list of users list was too large it wouldn't work but it's an enormous list of users...so I just had to shorten the distance in posts.

After doing that I ran SQL Query of DELETE FROM post WHERE userid = 0 to get rid of all the posts from users who were turned into guests. Updated all counters and I accomplished what I have been trying to do for about a month.

I'm nominating for MOTM!

Merriweather
04-04-2011, 03:10 AM
Installed on 4.1.2 but getting the same issue as a previous user - db error when I choose "User has never posted (also count in social groups and blogs)."

The error is:

Database error in vBulletin 4.1.2:

Invalid SQL:
SELECT
`user`.*
FROM
user AS user
LEFT JOIN groupmessage AS groupmessage ON `groupmessage`.postuserid = `user`.userid
LEFT JOIN blog_text AS blog_text ON `blog_text`.bloguserid = `user`.userid
WHERE
`user`.`lastactivity` < 1270354181 AND `user`.`usergroupid` = 2 AND `user`.`posts` = 0 AND `groupmessage`.gmid IS NULL AND `blog_text`.blogtextid IS NULL AND `user`.`userid` NOT IN (0);

MySQL Error : The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
Error Number : 1104
Request Date : Sunday, April 3rd 2011 @ 09:09:41 PM
Error Date : Sunday, April 3rd 2011 @ 09:09:41 PM
Script : http://www.mysite.com/admincp/users_cleanup.php?do=test
Referrer : http://www.mysite.com/admincp/users_cleanup.php?do=add
IP Address : 76.28.215.148
Username : MyUserName
Classname : vB_Database
MySQL Version : 5.0.51a-24+lenny5-log

Vitaly
04-05-2011, 05:48 PM
Seems to be mysql 5.0 bug http://www.zen-cart.com/forum/showpost.php?p=618714&postcount=4

Try to insert
$db->query_write("SET OPTION SQL_BIG_SELECTS=1");

BEFORE that line

https://github.com/rcdesign/vb-users_cleanup/blob/master/upload/includes/functions_users_cleanup.php#L151

and tell me result + how many visitors registered on your forum.

Kraxell
04-09-2011, 04:37 PM
Hello,

i have installed this plugin but if a run the task, its nothing happen. any idea?

giaguaro
04-09-2011, 06:20 PM
this is funny..
I added the product and this worked correctly.
I have it in the installed products.
I have it in the ACP general options.
I havent it in the ACP users panel.. :(

i am running 4.1.2

giaguaro
04-09-2011, 07:14 PM
i mean i can set the time and frequence options in the ACP panel, but i dont find where to set WHAT users i have to clean

giaguaro
04-10-2011, 09:47 AM
by the way, i have a ton of RC jeepers on my site..

Kraxell
04-11-2011, 07:48 PM
@giaguaro

this option is in the "Users"-Panel (where you can edit users etc.) in ACP.

giaguaro
04-26-2011, 05:51 PM
as i told you, i have not the option in the User panel.
Everything else seem to be there correctly..

rob01
04-26-2011, 11:25 PM
there is no way for recovering the userids, of the people which got deleted?

LBGSHI
04-27-2011, 08:14 PM
I'm using 4.1.3, and I've also installed the mod as instructed, and do not see it under Users in the Admin CP...

giaguaro
04-28-2011, 06:07 PM
I'm using 4.1.3, and I've also installed the mod as instructed, and do not see it under Users in the Admin CP...

me too. But no answer..

AWMGolfer
04-28-2011, 10:16 PM
Great mod, what I would love to see and would absolutely use it if it is possible is if instead of deleting members they would be moved into a membergroup. For example I want to have a deactivated accounts membergroup and if they haven't visited in two months they are moved into this group.

giaguaro
04-30-2011, 05:37 PM
me too. But no answer..

up. Need assistance.. :(

giaguaro
05-07-2011, 06:50 AM
up. Need assistance.. :(

up, need assistance

dmm2020
06-21-2011, 03:18 AM
What I would like to see in something like this is ability to prune members who have not accepted the rules yet. Any way to add that in easily?

Gecuba
06-27-2011, 01:28 PM
For example I want to have a deactivated accounts membergroup and if they haven't visited in two months they are moved into this group.Try Move Inactive and Lurker Users To New Usergroup (https://vborg.vbsupport.ru/showthread.php?t=231874) mod

pantani
06-29-2011, 01:04 PM
Nice and easy tool, works perfect here on 4.1.4, thanks for this ;)

ckeins
07-11-2011, 09:39 AM
I've got some other problems with spam-users. Let me explain my problem, and see if this mod can do this or can be modified easily.

I run a car forum, where every user can specify his car/model via 2 custom profile fields. spam bots do always fill out these fields upon registration and always choose the first option of these custom fields.
can I insert these custom profile fields into this mod, to find only users, who have filled out these 2 profile fields with the first answers?

LBGSHI
08-04-2011, 07:19 PM
Awesome; thanks.

Videx
08-06-2011, 12:50 AM
...can I insert these custom profile fields into this mod, to find only users, who have filled out these 2 profile fields with the first answers?Assuming you've already eliminated spambots with one of the many solutions for them, I can only say I wish I was as lucky as you that our spam-humans would be so obvious. The way it is, I can't tell them from real members and that makes squashing them particularly difficult.

riteshsanap
01-24-2012, 02:33 PM
The Best Mod Ever, thank you very much

TombstoneWarrior
01-24-2012, 05:42 PM
why do i need a title and what do i put there also what would i put in display order?
also how would i do a admin control of this mod?

14DH01
01-24-2012, 06:13 PM
hello,
This mod allows it to put the id in order?

ID:1,2,5,7,8,10...
ID:1,2,3,4,5,6...

Thank you ;)

gsmlover4u
02-08-2012, 05:50 AM
is it working with vb 4.1.10 ?
cause its not working for me its show me blank page when i click on test

sarangan
02-11-2012, 10:54 AM
It's doesn't works for me either. I'm using 4.1.10

Black Tiger
07-17-2012, 01:34 PM
I just upgraded from version 0.1 to 0.4.
Now above it says this statement:
(!) For upgraders - your cleanup rule swill be disabled! Plese, recheck & enable again.
But I checked and neither the cleanup rules nore the cronjob were disabled as stated.
Did I do something wrong or can I just ignore the fact that they were not disabled?

Black Tiger
07-17-2012, 04:32 PM
Found it.
I thought you ment the rules themselfs would be disabled, but it's the mod itself, there where the rules are place in users->cleanup.
Enabled it again. Works like a charm on 3.8.7.

datoneer
07-22-2012, 05:38 PM
Great mod just what i needed. Installed & Nominated

Nirjonadda
08-10-2012, 08:02 PM
Developer Last Online: Sep 2011

Any one can update it for work on 4.1.10 ?

Danny Diamond
08-19-2012, 04:30 AM
It does NOT work for 4.1.12

10giay.com
08-19-2012, 06:43 AM
I need user vb version 4.2.0 PL2

Tize.
09-20-2012, 04:27 PM
Nominated, Installed, and 5stars.
Works perfect in vBulletin 4.0.7
Thanks.

maximoII
09-21-2012, 02:27 PM
works ok with 4.1.7
Would be nice to add in the rule something to clear Invalid/rejected email

sverdios
10-05-2012, 11:25 AM
Great mod just what i needed. Installed & Nominated

yea me too, I need to clean my db

MattGarner
11-08-2012, 05:06 PM
Has anyone tried this in 4.2?

toibs
11-29-2012, 08:27 AM
Same question here - Does this work in 4.2.x?

navossoc
12-09-2012, 10:22 PM
Same question here - Does this work in 4.2.x?

Yes, it works. Tested on 4.2.0 PL3.

gsmlover4u
05-13-2013, 08:46 AM
when i click on test it show only blank page i am using vb 4.2.1

The Rocketeer
09-06-2013, 06:18 AM
Works okay in 4.2.1.

@gsmlover4u have you uploaded the files in the upload folder? also you have to select / tick one of the options in the page eg. xxx days before clicking test. pretty good plugin for what it is. Thanks :)

sargunamtech
09-06-2013, 11:39 PM
hi there

i have a problem and i hope someone can help. i am getting the following error which i dont know what to do ....

/admincp/user.php?do=dopruneusers

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@******.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

ozzy47
09-06-2013, 11:41 PM
You need to check the email that you should have received and post the full error, what you posted is of no help.

Or check your server error logs, if you don't know where they are at, ask your host.

caciocode
10-25-2013, 04:30 PM
Could anyone help please.

This does not work at all. It returns a blank page when I click on test.

Am I missing something.

I have uploaded the files.

Vbulletin is powered by vBulletin® Version 4.2.1

Thanks.

DemOnstar
11-03-2013, 06:03 AM
is there another add on that can do this job and has been proved to do so?

Thanks...

ozzy47
11-03-2013, 09:53 AM
Why is this not working correctly for you?

gsmlover4u
11-06-2013, 04:00 PM
is there any option to delete user which are registerd on specific date ?
for example i want delete user which are registerd on 11/06/2013 ?

aquabid
11-11-2013, 01:29 AM
is there any option to delete user which are registerd on specific date ?
for example i want delete user which are registerd on 11/06/2013 ?

Use the User registered between X and X days ago option. Count the number of days back

aquabid
11-11-2013, 01:30 AM
Can we get a option where Registration Date equals Last Activity Date?

sreeve
11-16-2013, 07:59 AM
Could anyone help please.

This does not work at all. It returns a blank page when I click on test.

Am I missing something.

I have uploaded the files.

Vbulletin is powered by vBulletin? Version 4.2.1

Thanks.

I'm also having this issue and running 4.2.1

AlpineZone
11-18-2013, 04:44 PM
Um, so how does this work? I have like 30,000 registered users in the past four days. I want to delete all of them, and their posts and threads.

I run the test then click Delete, OK and it says Invalid Action Specified, then No Users Matched Query, then it goes to the regular Prune page.

Videx
11-18-2013, 05:50 PM
I don't know; maybe it's timing out - try smaller chunks if possible. But did you really get THIRTY THOUSAND junk registrations in the last 4 days?????

AlpineZone
11-18-2013, 07:28 PM
I don't know; maybe it's timing out - try smaller chunks if possible. But did you really get THIRTY THOUSAND junk registrations in the last 4 days?????

I'll try a smaller one.

Yeah, like 28,000 registrations and 200,000 posts. On SkiMRV.com. Working it now ... slowly. One spam account alone had 48,000 posts.

MattGarner
11-24-2013, 02:34 PM
The test thing doesn't seem to even work on 4.2.2?

davidg
12-09-2013, 05:56 PM
The test thing doesn't seem to even work on 4.2.2?

then u are doing something wrong because it works just fine with 4.2.2

J.kay
12-28-2013, 10:41 PM
not working on 4.2.2

jazmos
01-05-2014, 06:22 PM
I installed this product on VB 4.2.2 and did a test and the test seems to work. However how does the product run and delete users? I know there is a manual and automated mode but where do I set those options and when does the automated mode run? I have over 40,000 Users awaiting Email Confirmations dated back to 2004 that I need to delete and using the prune option yields 1000 users deleted at a time.

btedition
01-06-2014, 12:51 PM
This works great on 4.2.0, can't we add a search string to search for a specific IP ?

jazmos
01-06-2014, 04:21 PM
What version of this product are you running on VB 4.2.2 that is working? I see that there is 3 different releases and I think I tried the third one which Is .04 I believe. I see all the files were last modified March 21, 2011 in the folder I downloaded for this product. Is that the latest version?

YOODA230
02-24-2015, 09:40 PM
any updates?

Alibass
02-24-2015, 09:55 PM
any updates?
Kinda doubt it, coder has be online since July of last year and there has been no updates since 2011.

PeteMarko
03-02-2015, 10:26 PM
I don't see an option to clean users in / users? V4

Alibass
03-02-2015, 10:51 PM
In admincp/users/cleanup then click add rule...

PeteMarko
03-03-2015, 12:03 AM
I don't see anything called cleanup in the user area of admincp?

TheLastSuperman
03-03-2015, 12:21 AM
I don't see anything called cleanup in the user area of admincp?

Log into admincp, now on the left look for:

Users > Cleanup

Example:
https://vborg.vbsupport.ru/attachment.php?attachmentid=118509

It's in the small left column on the left, click to expand the users box then @ the very bottom is the link. *If the link is not there under the users box in admincp, that means you didn't upload the files properly. When you download the mod its in a .zip archive, once you extract the files and folders there is a folder titled "upload" <-- you upload whats WITHIN that folder to your forums, DO NOT upload the entire "upload" folder else it won't work i.e. the files required are now within /public_html/upload/admincp/themodsfiles.php instead of public_html/admincp/themodsfiles.php because the "upload" folder was just a place holder for the files not the folder they need to be in on your server.

PeteMarko
03-03-2015, 12:32 AM
After uploading I import product users cleanup from my computer can you verify please

PeteMarko
03-03-2015, 12:37 AM
All done and good, perfect, thank you :)

PeteMarko
03-03-2015, 12:45 AM
Just trying to delete all users with zero posts and do not belong to certain groups, eg, administrators, top poster etc. It does not seem to play to the rule after I save ?

PeteMarko
03-03-2015, 12:49 AM
I get invalid query, this is what was happening in the default move / prune routine also?

TheLastSuperman
03-03-2015, 01:28 AM
Can you post a screenshot of the error?

Also how many members are listed with 0 posts from phpmyadmin? I would check and verify that its not a large number... if any mod attempts to delete via query a large amount of data or tons of users accounts it could timeout or produce a similar error (possibly it depends on a number of factors server type mainly) and this is why with most of the maintenance offered within the admincp you see notations about processing in batches of 250/500 but nothing over 500.

PeteMarko
03-03-2015, 05:50 AM
I have been trying to delete far in excess of 500 so I'm sure that is the issue, I will try less and report back.

Is there away to restrict the amount of deletions? Doing by checking the list manually is longwinded.

Thank you for your response so far, its appreciated :)

PeteMarko
03-03-2015, 06:44 AM
I have managed to delete the contacts I needed to by doing it in chunks. :)

TheLastSuperman
03-03-2015, 12:29 PM
I have been trying to delete far in excess of 500 so I'm sure that is the issue, I will try less and report back.

Is there away to restrict the amount of deletions? Doing by checking the list manually is longwinded.

Thank you for your response so far, its appreciated :)

No place to edit and enter in a #, no. However in a sense by showing w/ option to check it simply won't process in a large batch. Long winded yes but for inexperienced users more safe than typing out a query that their unsure of what exactly its doing etc.

I have managed to delete the contacts I needed to by doing it in chunks. :)

Awesome :D.

Reminisce32
10-17-2015, 03:53 AM
Just installed this on my 4.2.3 and activated plugin and the Clean Up link shows up no where in my Users section of admincp. Help please...?

andy2295
11-15-2015, 06:05 AM
Works fine on 4.2.3 providing you dont try to prune more than 500 users at once

Islamic Board
07-08-2016, 10:04 PM
The "User has never posted (also count in social groups and blogs)." is not taking deleted posts into account. I want to be able to remove only those user who have really never posted, not those whose posts were deleted.

twistedsoul
01-15-2017, 09:05 PM
is there a way to make it move those inactives to an inactive usergroup instead of deleteing the user?

tanzeelniazi
10-03-2017, 11:18 PM
i dont understand when i make a rule in Users Cleanup Rules Manager after Mod what do ?
i mean i create test rule no 1
User has not visited for days or more 365 days or more
User belongs to main usergroup [Members]
User has never posted (also count in social groups and blogs).
then save after when i click the test button i see i have 20000 members have 0 posts and at the below i see Action is Delete or Move so what i need to select from the last action ?
If i Tick yes and select Delete then mod need to activate or auto process on and delete these members ?

Can you have some more features like Total Post and Total threads ? your Mod has only post not threads.
Help----