ciuflingar
2009-10-13T13:37:47Z
Hi there,

I'm trying to integrate YAF with custom membership and role providers and login from a custom Login page. I followed the instructions here , but calling YAF.Classes.Data.DB.user_register fails all the time.

I use the YAF 1.9.3-FINAL, .NET Framework 3.5 and IIS 7 in a development environment on my local server.

I have built the source for and debugging I came across an interesting stuff.Below is an excerpt from db.cs where the implementation of user_register method is:

static public bool user_register( object boardID, object userName, object password, object hash, object email, object location, object homePage, object timeZone, bool approved )
{
using ( YafDBConnManager connMan = new YafDBConnManager() )
{
using ( SqlTransaction trans = connMan.OpenDBConnection.BeginTransaction( DBAccess.IsolationLevel ) )
{
try
{
using ( SqlCommand cmd = DBAccess.GetCommand( "user_save", connMan.DBConnection ) )
{
cmd.Transaction = trans;
cmd.CommandType = CommandType.StoredProcedure;
int UserID = 0;
cmd.Parameters.AddWithValue( "UserID", UserID );
cmd.Parameters.AddWithValue( "BoardID", boardID );
cmd.Parameters.AddWithValue( "UserName", userName );
cmd.Parameters.AddWithValue( "Password", FormsAuthentication.HashPasswordForStoringInConfigFile( password.ToString(), "md5" ) );
cmd.Parameters.AddWithValue( "Email", email );
cmd.Parameters.AddWithValue( "Hash", hash );
cmd.Parameters.AddWithValue( "Location", location );
cmd.Parameters.AddWithValue( "HomePage", homePage );
cmd.Parameters.AddWithValue( "TimeZone", timeZone );
cmd.Parameters.AddWithValue( "Approved", approved );
cmd.Parameters.AddWithValue( "PMNotification", 1 );
cmd.ExecuteNonQuery();
}

trans.Commit();
}
catch ( Exception x )
{
trans.Rollback();
YAF.Classes.Data.DB.eventlog_create( null, "user_register in YAF.Classes.Data.DB.cs", x, EventLogTypes.Error );
return false;
}
}
}
.
.
.

As you can see user_register tries to pass an @Password parameter to yaf_user_save procedure. Now checking procedures.sql from install/MSSQL folder I noticed that yaf_user_save dos not accept as parameter @Password. You can see the CREATE PROCEDURE code snippet below.

CREATE procedure [{databaseOwner}].[{objectQualifier}user_save](
@UserID int,
@BoardID int,
@UserName nvarchar(50) = null,
@Email nvarchar(50) = null,
@TimeZone int,
@LanguageFile nvarchar(50) = null,
@ThemeFile nvarchar(50) = null,
@OverrideDefaultTheme bit = null,
@Approved bit = null,
@PMNotification bit = null,
@ProviderUserKey nvarchar(64) = null)
AS
begin
.
.
.

Is this a bug or I am doing something wrong, like missed some configuration or something?Does anyone know about this?

Any help would be appreciated. Thanks
Sponsor
innovanet
2009-10-25T13:40:46Z
I'm having the exact same problem at the moment (I was trying to complete the integration today). I'll let you know if I figure this one out but at the moment it almost seems like a bug. I was thinking it might have been a faulty database upgrade but it looks as though you're using a fresh install.

I'm coming from a 1.9.1 upgrade.
ciuflingar
2009-10-25T14:17:55Z
innovanet wrote:

I'm having the exact same problem at the moment (I was trying to complete the integration today). I'll let you know if I figure this one out but at the moment it almost seems like a bug. I was thinking it might have been a faulty database upgrade but it looks as though you're using a fresh install.

I'm coming from a 1.9.1 upgrade.



I made the integration and there is no need to call user_register method or any other methods. I didn't check how it works but my guess is that the user_register method( and other methods) is for an earlier version of YAF.

I just implemented my custom MembershipProvider, RoleProvider and kept YafProfileProvider( I think this one is needed or at least the custom profile provider must inherit from YAF's profile provider) and it works.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved