YAFLogo

aberent
  • aberent
  • 51.2% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
I am trying to install YAF onto my online chess  playing website. I want all of my existing members to have forum accounts from day one.

Does anyone have a SQL Script that will create a YAF user they would be willing to share with me?


Sponsor
aberent
  • aberent
  • 51.2% (Neutral)
  • YAF Forumling Topic Starter
13 years ago
I figured it out myself. Here is the stored procedure I wrote to accompish user additions to YAF

CREATE PROCEDURE dbo.ssp_CreateUser

@Username nvarchar(256)

, @Password nvarchar(256)

, @Email nvarchar(256)

AS

SET NOCOUNT ON

DECLARE @UserId nvarchar(64)

DECLARE @ApplicationName nvarchar(256)

DECLARE @IsApproved bit

IF EXISTS (

SELECT NULL FROM dbo.yaf_User WHERE Name = @Username

)

BEGIN

RETURN

END

SET @ApplicationName = 'YetAnotherForum'

SET @IsApproved = 1

EXECUTE [dbo].[yaf_prov_createuser]

@ApplicationName= @ApplicationName

,@Username = @Username

,@Password = @Password

,@Email= @Email

,@IsApproved = @IsApproved

,@UserKey = @UserId OUTPUT

INSERT INTO dbo.yaf_prov_RoleMembership (RoleId, UserId) VALUES ('F3893F9F-79CD-48D4-9596-D5664CF44246', @UserId)

INSERT INTO dbo.yaf_User

(

BoardID

, ProviderUserKey

, Name

, DisplayName

, [Password]

, Email

, Joined

, LastVisit

, NumPosts

, TimeZone

, RankID

, OverrideDefaultThemes

, PMNotification

, AutoWatchTopics

, DailyDigest

, NotificationType

, Flags

, Points

)

VALUES

(

1

, @UserId

, @Username

, @Username

, 'na'

, @Email

, GETDATE()

, GETDATE()

, 0

, -420

, 3

, 0

, 0

, 0

, 0

, 30

, 2

, 0

)

RETURN

---------- / dbo.ssp_CreateUser -------------------------------------------------------

GO