YAF and MojoPortal (integration)

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
4/15/2011 6:53:03 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi,

I use YAF 1.9.5.6 from svn and MP 2.3.6.4. You should not encounter any problems with it. Really, I can't help with it as I don't encounter any problems with url rewriting. It has 2 YAF boards in 1 MP site and even in the case it works fine. I use it with Postgre as database but it doesn't matter.

I think you have problems with Forum.aspx.cs control.

There's a profile sync problem and you should enter display name by hand in YAF,  but nothing more. 

Really, I've posted exactly the code I use on my site. Try to move all entries from user.config to web.config.

Make sure that you've enabled it for YAF in Forum.ascx.cs control.

Page.EnableViewState = true;         
        
         

   

9/2/2011 9:53:11 AM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi, everyone.

Just some clarification about FAQs on integration as asked on YAF forum.

1. Profiles.

People experiencing difficulties as YAF profile doesn't work being integrated into Mojo.

Hopefully Joe will help here. A field in users table is required like IsDirty. The corresponding functionality is already in YAF. If you change something in Mojo user profile the field should be set to dirty. The same is with a newly registered user. When a module detects the token it syncs its own data and sets the field to false.

A workaround is too resource consuming.

2. URL rewriting.

This is planned for implementation. The problem is that to solve it you should merge YAF and Mojo solutions. I still don't have time for it.

3. Display Names.

As Mojo uses emails as user names, right after a user first visits forum he sees email as his nick. Technically, he should go to his profile and pick a YAF Display Name. The problem can be solved the same as in p.1 way.

Looking with hope towards Joesmiley

Best, bob.

 

9/2/2011 11:24:07 AM
Gravatar
Total Posts 18439

Re: YAF and MojoPortal (integration)

Hi Bob,

I think there is a better way. Having an IsDirty field seems limited. What if multiple integrated features need to do some synchronization, then after the first feature sets IsDirty to false nothing else can respond to it, and in the case where there is no feature that needs to respond to it will just stay as true and be a meaningless field in the db.

Seems like a better solution would be to have a plugin system for handlers that can respond to a UserUpdated event and we could pass in the SiteUser object as an event argument. Then any number of features could respond to changes in a user profile and if there are no features that need to do this it is not creating some unused field in the db. So if we had a plugin system for this you could make a YAFUserChangedEventHandler to do the needed work.

We already have a plugin system for UserCreated event  that you could use to implement handling for new users, we just need a new one for handling user updated.

I can add a to do item in my project tracker for this plugin system.

Best,

Joe

9/2/2011 2:00:14 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi, Joe.

Yeah, I know, it's limited. As far as I can see you already have a sort of bubble event. Anyway, the problem is clear. Sometimes it's required to sync data. Currently, YAF DNN control has a dodgy logic - it simply syncs all providers by a time token. I don't like it and don't want to copy the logic as I want to make it as fast as possible.

Anyway I'm planning to update the module code to add some more functionality this month.

Best, bob. 

9/2/2011 2:04:43 PM
Gravatar
Total Posts 18439

Re: YAF and MojoPortal (integration)

Hi Bob,

So if I do create a plugin system for UserModified event handlers would that help you?

Then you would only need to implement a handler and plug it in by dropping an xml file in a folder. Your method would be called whenever a user profile is updated and it would pass in the SiteUser as an event argument.

You could implement a similar handler for user created as I mentioned before and plug it in the same way.

Best,

Joe

9/2/2011 6:08:51 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi, Joe.

Really, I don't know right now. Looks promising, simply I should look at it in depthwink.

But in DisplayName case when you create a user in MP, it's not in YAF tables (except Membership and Roles which are from MojoPortal in web.config). He appears in YAF user table (where DisplayName is) when a user first appears on a forum. It can't be changed.

Best, bob.

 

 

 

 

9/4/2011 7:26:01 AM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi, Joe.

I'll try to make it from Profile and Membership change data first. Maybe it'll be easier and will not require your efforts.

 

Just found an easy solution for display names. Previously I've recommended to use triggers, but as I have a lot of datalayers I've made a universal solution for this.

Put this in Page_Load of your ForumControl. Add a refebrence to YAF.Classes.Data assembly.

All YAF DisplayNames will be synced to mojoPortal LoginNames and you'll never see emails from start.

if (YafContext.Current.CurrentUserData.DisplayName != su.Name)
               {

                   LegacyDb.user_save(
                       YafContext.Current.PageUserID,
                       YafContext.Current.PageBoardID,
                       null,
                       su.Name,
                       null,
                       YafContext.Current.TimeZoneUser,
                       YafContext.Current.LanguageFile,
                       YafContext.Current.CultureUser,
                       YafContext.Current.Get<ITheme>().ThemeFile,
                       false, YafContext.Current.TextEditor,
                       YafContext.Current.CurrentUserData.UseMobileTheme,
                       null,
                       null,
                       null,
                       YafContext.Current.CurrentUserData.DSTUser,
                       YafContext.Current.CurrentUserData.IsActiveExcluded,
                       null);
                   // clear the cache for this user...)
                   YafContext.Current.Get<IRaiseEvent>().Raise(new UpdateUserEvent(YafContext.Current.CurrentUserData.UserID));
                  // YafContext.Current.Get<IDataCache>().Clear();
               }

Currently I'm working on the Profile problem probing different approaches. Hopefully, in the end of the month if we'll solve all major problems I'll publish the full code on the codeplex.

 

9/5/2011 10:35:37 AM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Just forgotten another FAQ question. When you use YAF with MP you should use a custom ProfileProvider which doesn't depend on other providers on db queries level like it's  a case with  YAF standard profile provider. Else your YAF profile settings will not be saved.

 

9/6/2011 3:01:28 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Profiles in MojoPortal and YAF can be synced based on profile update time. YAF has the standard Profile property. This doesn't envolves any complexities.

Currently profile is synced to Mojo every time when the YAF control loads. Except UrlRewriting and the minor problem everything works and ready. If Mojo has a profile change token I can make a sync based on it.

Meanwhile YAF 1.9.6 Beta1 released the module will be mostly linked to it. As I use Postgre, I don't have MS SQL Profile Provider which is independent from YAF Membership or any Membership except Mojo Membership. If anyone has it I can publish it this weekend.

 

 

 

 

9/7/2011 6:46:44 PM
bob
Gravatar
Total Posts 126
YAF developer

Re: YAF and MojoPortal (integration)

Hi, Joe.

It seems that the event can't be raised from my module at all.  Or at least I can't make it to do it.

www.mojoportal.com/user-registered-event-handlers.aspx

Anyway I've made a profile sync from YAF profile to MP and solved the problem with provider - it will be YAF one relinked to mojoPortal users table and some minor tweaks too. So far the sync from Mojo side will be disabled if we'll not find a solution. Technically, everything except UrlRewriting works now. The rewriting requires some time as I want a standard solution.

Best, bob.

Update: I've modified YAF provider and made it universal for integration. Profiles with mojoPorta; are synced on the fly as a temporary solution. ActiveDiscassions basic control is available too . So this weekend I'll publish the first public beta version after some tests. Thanks for help.

 

9/9/2011 9:22:44 AM
Gravatar
Total Posts 18439

Re: YAF and MojoPortal (integration)

Hi Bob,

The idea with the event handlers is not that they would be triggered from within the module, they would be triggered when a user registers or when a user edits his profile. You would just implement a class that inherits from UserRegisteredHandlerProvider and implement the override for UserRegisteredHandler, then you create an xml file that declares your handler and drop it in the /Setup/ProviderConfig/userregisteredhandlers folder. In the method you would do whatever you  need to do to sync that user for YAF.

The article has example code you could copy and modify.

Currently we only have the plugin model for user registered but it would not be difficult for me to make similar plugin system for user profile changes.

This would be much more efficient than polling tables for changes.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.