EllisLab text mark
Advanced Search
     
Delete all members - EE1
Posted: 07 August 2012 04:24 PM   [ Ignore ]
Avatar
Joined: 2008-05-05
187 posts

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);


?> 
 Signature 

Porter Foster
Marketing Alliance, Inc.

 
Posted: 07 August 2012 09:23 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-18
631 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

 Signature 

Bhashkar Yadav
http://www.sidd3.com

 
Posted: 08 August 2012 09:09 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-05
187 posts

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.

 Signature 

Porter Foster
Marketing Alliance, Inc.

 
Posted: 08 August 2012 03:20 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2011-03-18
631 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

 Signature 

Bhashkar Yadav
http://www.sidd3.com

 
Posted: 08 August 2012 04:01 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-05
187 posts

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.wink

 Signature 

Porter Foster
Marketing Alliance, Inc.