Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-25-2013, 11:23 AM
alirex alirex is offline
 
Join Date: Nov 2007
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SQL Querry required for Deleting users not active.

Dear All

I need an SQL query to run from phpmyAdmin to remove all the users who are not active since 100 days. I tried from adminCP but looks like it is huge number of spammer and non active users which make my whole site getting slower. So i feel its good to run a query instead of doing it from AdminCP.

So if someone know kindly give answer.

Thank You in Advance.

I have searched from google alot but looks like i am not able to find one
Reply With Quote
  #2  
Old 09-25-2013, 11:32 AM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

have you tried doing it with prune options. Also best not to delete users with posts just make a new group and move them to that one
Reply With Quote
Благодарность от:
tbworld
  #3  
Old 09-25-2013, 01:43 PM
alirex alirex is offline
 
Join Date: Nov 2007
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForceHSS View Post
have you tried doing it with prune options. Also best not to delete users with posts just make a new group and move them to that one
I actually mentioned in my post but anyways.. I have tried from admincp to prune but it start lagging my site bcoz too many users are in the list.

My forum is readonly so there is no such loss for me, most of my active users are visitors they dont care to make account. Most of accounts are of Bots/Spammer/Spider etc
Reply With Quote
  #4  
Old 09-25-2013, 03:12 PM
ChilaxinC ChilaxinC is offline
 
Join Date: Dec 2011
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am not responsible for any damage caused by you following this!
***THIS IS NOT RECOMMENDED FOR USERS WITH POSTS***
I put that disclaimer, but I did test it myself just to be sure

In phpMyAdmin, under your vBulletin database, look for the table "user".

This shows you all sorts of information, including the "lastactivity". This is based on Unix time, for example on my users table last activity, the first date I see is: 1380060934, which is 9/24/13 5:15:34pm EST

You can choose a date that you would like to remove users before, you wanted 100 days ago, which is June 17, 2013 ( Add/subtract Dates Here )

Go here to get the Unix time of a date: http://www.unixtimestamp.com/index.php

June 17, 2013 in Unix time is: 1371445200

Now to delete the users before that timestamp should look something like:
Code:
DELETE FROM user WHERE lastactivity < '1371445200'
*** DO NOT USE THIS IF YOUR USERS HAVE POSTS***

If your users may have posts use the below code instead, the above was only for alirex's special case.
Code:
DELETE FROM user WHERE lastactivity < '1371445200' AND posts = '0'
Reply With Quote
Благодарность от:
alirex
  #5  
Old 09-25-2013, 05:27 PM
alirex alirex is offline
 
Join Date: Nov 2007
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ChilaxinC View Post
I am not responsible for any damage caused by you following this!
I put that disclaimer, but I did test it myself just to be sure

In phpMyAdmin, under your vBulletin database, look for the table "user".

This shows you all sorts of information, including the "lastactivity". This is based on Unix time, for example on my users table last activity, the first date I see is: 1380060934, which is 9/24/13 5:15:34pm EST

You can choose a date that you would like to remove users before, you wanted 100 days ago, which is June 17, 2013 ( Add/subtract Dates Here )

Go here to get the Unix time of a date: http://www.unixtimestamp.com/index.php

June 17, 2013 in Unix time is: 1371445200

Now to delete the users before that timestamp should look something like:
Code:
DELETE FROM user WHERE lastactivity < '1371445200'

Thank you , it works without problem. Its really helpfull query specially when alot of spammer need to be remove. From admincp it was easy if number of members are less. But now its good.

Thanks once again.
Reply With Quote
  #6  
Old 09-25-2013, 05:34 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I hope you only deleted the members with 0 posts if I was not so busy I could of helped more
Reply With Quote
  #7  
Old 09-25-2013, 05:36 PM
alirex alirex is offline
 
Join Date: Nov 2007
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ForceHSS View Post
I hope you only deleted the members with 0 posts if I was not so busy I could of helped more
Yes as i said above it is read only forum , so guest and registered members are not able to make any post. Only staff can post content rest all are watching it or discussing in shoutbox.
Reply With Quote
  #8  
Old 09-25-2013, 05:39 PM
ForceHSS ForceHSS is offline
 
Join Date: Apr 2008
Posts: 6,357
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So u deleted members with 0 posts good will be less problems
Reply With Quote
  #9  
Old 09-25-2013, 08:12 PM
ChilaxinC ChilaxinC is offline
 
Join Date: Dec 2011
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by alirex View Post
Thank you , it works without problem. Its really helpfull query specially when alot of spammer need to be remove. From admincp it was easy if number of members are less. But now its good.

Thanks once again.
No problem at all, and like ForceHSS said this is not recommended to use if you have a forum with users that have posts, but a simple change to the query could prevent problems of that nature:
Code:
DELETE FROM user WHERE lastactivity < '1371445200' AND posts = '0'
Now it is only deleting users that have 0 posts and the last activity was before the timestamp.
Reply With Quote
  #10  
Old 09-25-2013, 10:35 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should really use the prune function, and decrease the number of users you're doing in a single pass. You're not removing all of the user data correctly if you only drop from the user table.
Reply With Quote
Благодарность от:
tbworld
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04364 seconds
  • Memory Usage 2,264KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (3)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete