Author Topic: Mass ID Changer  (Read 862 times)

0 Members and 1 Guest are viewing this topic.

Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Mass ID Changer
« on: July 29, 2009, 11:19:22 PM »
This script, which can be uploaded like repair_settings.php into root directory (where Settings.php is located), will give you an interface to batch-change all the ID's of the members of your forums.

Doing this will execute queries that will re-attribute their posts, post count, linked avatar, and stats as well so nothing is lost. The only difference is the new ID.

I strongly recommend making a backup of your DB before using this.

Please note this is made only for SMF 2.0.
« Last Edit: July 30, 2009, 05:51:30 PM by ccbtimewiz »

Offline Link

  • Ninja Hacker
  • Jr. Member
  • *
  • Posts: 147
  • Karma: 485
  • Gender: Male
  • Hyrule's Defender
    • The Ninja's Hideout
  • SMF Version: 2.0 RC2
Re: Mass ID Changer
« Reply #1 on: July 30, 2009, 05:20:24 PM »
Works good, BUT...uploaded avatar ID's aren't changed, so it breaks uploaded avatars. :S
Obedire est vivere, Vivere est obedire


Offline ccbtimewiz

  • Dreamer
  • Guru
  • *
  • Posts: 1304
  • Karma: 2100
  • Gender: Male
  • $info->close();
    • Dream Portal
  • SMF Version: SMF 2.0 RC4
Re: Mass ID Changer
« Reply #2 on: July 30, 2009, 05:49:56 PM »
:
// It's near impossible to update their avatar properly if encrypted attachments are enabled.
// So.. just delete the avatars. Both the new ID and the old ID (if an avatar exists for that ID).
require_once($sourcedir . '/ManageAttachments.php');
removeAttachments(array('id_member' => (integer) $_REQUEST['new_id_' . $id]));
removeAttachments(array('id_member' => $data['id']));

Uploaded avatars that are in the attachments directory are close-to-impossible to fix as it would take a lot of code to do. So I just coded it to delete 'em.