ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Mass Delete of Members

September 05, 2013 6:10pm

Subscribe [3]
  • #1 / Sep 05, 2013 6:10pm

    APGWest

    295 posts

    I heart EE and EllisLabs but I’m nervous with this new support system that I might not get the help I desperately need right now.  Here goes….

    I have a MASSIVE amount of pending and approved members in our database.  To the tune of about 200,000 pending and 400,000 members.  All but about 4,000 are spam accounts.

    [insert the obligated ‘lets smack this guy for not checking his tables more often’ bit here]

    I need to purge ALL pending and all members with a last_visit of 0 in the exp_members table.  I know they have to be removed from the three tables: exp_members, exp_member_data, and exp_member_homepage.  I just don’t trust myself to write the query right.

    so, who out there wants to help a fella out???

  • #2 / Sep 09, 2013 12:25pm

    APGWest

    295 posts

    Anyone?

  • #3 / Sep 09, 2013 2:19pm

    Bhashkar Yadav

    727 posts

    Hi Don,

    Yes, you can do it with one query:

    DELETE exp_members, exp_member_data, exp_member_homepage FROM exp_members 
    INNER JOIN exp_member_data 
    INNER JOIN exp_member_homepage 
    WHERE exp_member_data.member_id = exp_members.member_id 
    AND exp_members.member_id = exp_member_homepage.member_id 
    AND exp_members.group_id = 'x'

    Where x is the member group.

    I would suggest you to take backup before running this query.

     

  • #4 / Nov 09, 2013 4:59pm

    reedy

    19 posts

    Quick question - would this query needs to be changed if running the forum module to make sure there is no orphaned data there?

  • #5 / Nov 09, 2013 11:46pm

    Bhashkar Yadav

    727 posts

    The above SQL will delete the members which are forum members also but not their forum threads/comments/topics. For it you, the SQL need to be modified.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases