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.

Delete all members - EE1

August 07, 2012 4:24pm

Subscribe [1]
  • #1 / Aug 07, 2012 4:24pm

    I found this code in another thread showing how to mass remove bogus member registrations, but it was for EE2.

    Does anyone have an EE1 translation of this?

    <?php
    
    $this->EE->db->select("member_id");
    $this->EE->db->where('group_id', 5);
    $this->EE->db->limit(5000);
    $q = $this->EE->db->get('members');
    
    $members = array();
    
    foreach ($q->result() as $row)
    {
    $members[] = $row->member_id;
    }
    
    echo count($members);
    
    $this->EE->load->model('member_model');
    $this->EE->member_model->delete_member($members);
    
    
    ?>
  • #2 / Aug 07, 2012 9:23pm

    Bhashkar Yadav

    727 posts

    Hi Porter,

    You can use below code for EE1:

    <?php
    
    global $DB;
    
    $q = $DB->query("SELECT member_id FROM exp_members WHERE group_id = 5 LIMIT 5000");
    
    $members = array();
    
    foreach ($q->result as $row)
    {
    $members[] = $row['member_id'];
    }
    
    echo count($members);
    $mem_str = implode(",", $members);
    
    $DB->query("DELETE FROM exp_members WHERE member_id in ( $mem_str )");
    
    ?>

    Please Note: I haven’t tested this code.

    I hope this code would help you.


    Best Regards,
    Bhashkar

  • #3 / Aug 08, 2012 9:09am

    Thank you Bhashkar!

    We had an old old site that was taking forever to log in, and I discovered that there were over 120,000 bogus member registrations. I have now plugged the security hole, but I really wasn’t looking forward to the cleanup process.

    Thanks again,
    Porter.

  • #4 / Aug 08, 2012 3:20pm

    Bhashkar Yadav

    727 posts

    Hi Porter,

    Sorry, I forgot to mention few more queries which need to clean up the member data.
    As EE1.x doesn’t have member model so we need to write these queries.

    If you can find these all please let me know otherwise I can share here more details queries for deleting/removing more records from database tables which are referencing the members.


    Best Regards,
    Bhashkar Y

  • #5 / Aug 08, 2012 4:01pm

    If you have the queries handy, I would very much like to see all the places that the members were referenced in EE1. Having a partial removal might have an effect should we ever upgrade the site to EE2.

    My member listing is now down from 126,450 to 6, by the way.😉

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

ExpressionEngine News!

#eecms, #events, #releases