YAFLogo

yyvz
  • yyvz
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
Hi , I have only yaf.net solution on my site and after few months, I figure it out there is a sync problem with these two tables.
When a user registered. there is only yaf_prov_profile record on db not yaf_userProfile record. and when the user update it from cp_editprofile yaf_userProfile was created with new values not from yaf_prov_Profile table values. And old values in prov_profiles overwritten by new values. So I can not get users' custom properties what I set on registration.

I try to update register.ascx.cs with the sync code on EditUsersProfile.ascx.cs as below

// Sync to User Profile Mirror table while it's dirty
            SettingsPropertyValueCollection settingsPropertyValueCollection = userProfile.PropertyValues;
            LegacyDb.SetPropertyValues(PageContext.PageBoardID, UserMembershipHelper.ApplicationName(), this.currentUserID, settingsPropertyValueCollection);

but at that point user does not have a username on UserList table.

Is this a normal thing on yaf.net or an issue ?

I use yaf.net 1.9.6 with .Net 4.0 and not integrate anything like dnn etc.


Sponsor

bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
10 years ago
You should make 2 things.
1.Add user name to the methods
LegacyDb.SetPropertyValues(PageContext.PageBoardID, UserMembershipHelper.ApplicationName(), this.currentUserID, userProfile.UserName,
settingsPropertyValueCollection);

LegacyDb.SetProfileProperties(
string connectionString,
[NotNull] int boardId,
[NotNull] object appName,
[NotNull] int userID,
[NotNull] string userName,
[NotNull] SettingsPropertyValueCollection values,
[NotNull] List settingsColumnsList,
bool dirtyOnly)
And remove LegacyDb.UserList dependency.

2. Drop the FK.
[FK_{objectQualifier}UserProfile_{objectQualifier}User] foreign key (UserID) references [{databaseOwner}].[{objectQualifier}User]
yyvz
  • yyvz
  • 50.2% (Neutral)
  • YAF Forumling Topic Starter
10 years ago
I made a change like you suggested. But is it normal for yaf.net or an issue ?

Originally Posted by: bbobb 

You should make 2 things.
1.Add user name to the methods
LegacyDb.SetPropertyValues(PageContext.PageBoardID, UserMembershipHelper.ApplicationName(), this.currentUserID, userProfile.UserName,
settingsPropertyValueCollection);

LegacyDb.SetProfileProperties(
string connectionString,
[NotNull] int boardId,
[NotNull] object appName,
[NotNull] int userID,
[NotNull] string userName,
[NotNull] SettingsPropertyValueCollection values,
[NotNull] List settingsColumnsList,
bool dirtyOnly)
And remove LegacyDb.UserList dependency.

2. Drop the FK.
[FK_{objectQualifier}UserProfile_{objectQualifier}User] foreign key (UserID) references [{databaseOwner}].[{objectQualifier}User]



bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
10 years ago
Originally Posted by: yyvz 

I made a change like you suggested. But is it normal for yaf.net or an issue ?


This was normal for YAF and has become an issue after you've modified the source code 🙂
But the change may be included into YAF as it obviously makes it more flexible.
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
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