Merging User Accounts Script (CS 2.1, SQL)


posted by David Voss
Thu, Mar 22 2007

Downloads: 273
File size: 3.6kB
Views: 1,829
Merging User Accounts Script (CS 2.1, SQL)
Filed under: ,

The purpose of this script is to merge two existing user accounts into a single account with an option to change the username once the merge has been successful.  This script is specifically for Community Server 2.1.

Before executing the script, there are 3 variables which will need to be set. 

@CurrentUserName - The username of the current (active) account.
SET @CurrentUserName = 'John Smith'

@PreviousUserName - The username of the previous (old) account being merged into the current account.
SET @PreviousUserName = 'John Doe'

@DesiredUserName - The username the current account should use and/or be renamed as.
SET @DesiredUserName = 'John Smith'

Known Issues / Limitations:

  • Many of the records associated with a user's account will be merged with this process.  For example, the previous account's favorites will be attached to the to current account unless they've already been marked as favorites by the current account in which case they're deleted.
  • The previous account's profile information will not be merged into the current account.
  • The previous account's avatar will not be merged, regardless if the current account has an avatar or not.
  • The previous account's assigned roles are not merged.  If there are any roles the previous account was assigned to that the current account is not assigned to, they will have to be manually added by the administrator.
  • The Notes field of the cs_ModerationAudit table is not checked for usernames and will not be updated by this script.
  • The EditNotes field of the cs_PostEditNotes table is not checked for usernames and will not be updated by this script.
  • The post body (messages) will not be checked for usernames and will not be updated by this script.  This applies to cases where the user has been quoted and/or another user has referred to that user within their post.
  • This script was written for Community Server SP1, ASP.Net 2.0 schema.  There were additional tables added for the ASP.Net 2.0 version but only one that would be affected by merging accounts.  There is a check to see if the table exists so it shouldn't matter which version of ASP.Net you use for Community Server.  Also, the script was written and tested on SQL Server 2000 so I can't 100% guarantee that it works on SQL Server 2005.

Also, if you are running more than one installation of CS within the same database and not sharing the users, then please be aware that this script does not include the applicationId or settingsId.

Updated 03/23/2007: Replaced the portion of the script that dealt with changing usernames (optional) by using the stored procedure for renaming users. 

Comments

games for all wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Mon, Aug 27 2007 2:23 PM
Thanks ... !!
forum. wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Thu, Aug 30 2007 12:59 AM
thanks ... :)
swish wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Fri, Aug 31 2007 3:13 AM
very god thank you
upload photos wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Fri, Oct 5 2007 4:25 AM
thaanks ...
Feynman Huang wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Mon, Jul 7 2008 2:51 AM
Hi David: I use your script to merge 2 accounts at CS 2007, but I notice that the "TotalPosts" is zero for new CSUser. How could I solve it? Thank you, Feynman
押切もえ 画像 wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Thu, Jul 10 2008 10:49 PM
wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Wed, Jul 23 2008 8:30 AM
wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Wed, Jul 23 2008 8:30 AM
wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Wed, Jul 23 2008 8:31 AM
wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Wed, Jul 23 2008 9:11 AM
Dr.Adams wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Sun, Oct 19 2008 6:50 PM
Dr.Adams wrote re: Merging User Accounts Script (CS 2.1, SQL)
on Wed, Oct 29 2008 3:10 PM
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com