News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[SOLVED] Duplicate members...anyway to erase the extra membernames?

Started by ComposerRyan, October 22, 2006, 08:17:59 PM

Previous topic - Next topic

ComposerRyan

I had to merge all of my forums by converting SMF to phpbb, then merge them using the phpbb script and then converting them all back to SMF.

Well, the only problem that I see is that there are duplicate users.  So, for instance, when viewing the memberlist, my name "ComposerRyan" shows up 4 times.  This is the same for all the other users.  Is there anyway to delete the other duplicate names easily?

Most of them share the exact same e-mail address, post count, etc...they just have different forum IDs though.  What to do what to do...

Yikes.  :'(
Special Thanks to: Orstio, Simplemachines forums staff, and everyone who has helped me with any questions I have.

Oldiesmann

Try this...

<?php
include_once('SSI.php');

// Find the first instance of each username...
$query = db_query("SELECT ID_MEMBER, memberName FROM {$db_prefix}members", __FILE__, __LINE__);

// Delete the others...
while($results = mysql_fetch_assoc($query))
{
 
db_query("DELETE FROM {$db_prefix}members WHERE memberName = '$results[memberName]' AND ID_MEMBER != '$results[ID_MEMBER]'", __FILE__, __LINE__);
}
?>


Since MySQL will pull the results in ascending order by the member ID by default, that shouldn't cause any problems.
Michael Eshom
Christian Metal Fans

ComposerRyan

Sorry, but I'm really dumb at this kind of stuff...where do I put this file???

I'll go ahead and make a backup now just in case while I wait for your response.  I appreciate your help. :)
Special Thanks to: Orstio, Simplemachines forums staff, and everyone who has helped me with any questions I have.

JayBachatero

Just name it deletemembers.php and upload it to your site.  Then point your browser to it.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

ComposerRyan

I ran the script, but it deleted ALL the duplicates...I wanted it to keep at least one of the member names. :(

So, for instance, instead of keeping ONE "ComposerRyan" username intact, it just deleted ALL of them and did the same for all my other users.

Is there anyway you can fix the script so that it ONLY deletes the duplicates and keeps the originals?  Or is that asking for too much?
Special Thanks to: Orstio, Simplemachines forums staff, and everyone who has helped me with any questions I have.

ComposerRyan

Nevermind, I just migrated my Joomla users back into SMF and it seems to be working.  The only problem is that member's profiles don't work in some cases, which is okay.  No big deal...they'll have to get over it. lol

Thanks for your help, I appreciate it!
Special Thanks to: Orstio, Simplemachines forums staff, and everyone who has helped me with any questions I have.

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Advertisement: