YAFLogo

juanp2
  • juanp2
  • 62% (Friendly)
  • YAF Forumling Topic Starter
16 years ago
Okay.. I'm going down the integration path trying to get YAF nicely integrated into a parent project. So far so good.

This is perhaps not a 'bug' but depends on the overall design goals of the project. I'm not sure if a design goal it to allow some yaf controls to be used outside of YAF.

I've taken the EditUsersProfile control and embedded it in a web page. The intent is to allow the user to customize their forum profile, while they are customizing their profile in the parent application. Since the profile is not dependant on the page or forum per say, I assumed it would work.

It almost works, but breaks when it goes to retrieve the UserID. Tracing the code, it flows into the 'Context.cs'.

In "protected void InitUserAndPage()" it breaks at the point of

				

if ( this.Settings.CategoryID != 0 )
     categoryID = this.Settings.CategoryID;

because the this.Settings is null.

Now I'd like to change it to something like the following, so that the Context can still retrieve the UserID without needing the settings, etc.


if ( this.Settings != null ) {
     if ( this.Settings.CategoryID != 0 )
          categoryID = this.Settings.CategoryID;
}

If I do this, the control loads fine.

But without spending hours understanding the finer details, is this an accetable fix or would it be introducing more problems later?

Sponsor
test2005
16 years ago

If your worried, inside your check for a NULL, do a type cast to make sure the value is an int, as that's what is needed.


.....the man in black fled across the desert..........and the gunslinger followed.....

Jaben
  • Jaben
  • 100% (Exalted)
  • YAF Developer
16 years ago
Fixed in latest version... Made "Settings" property Auto-Init.
juanp2
  • juanp2
  • 62% (Friendly)
  • YAF Forumling Topic Starter
16 years ago

Fixed in latest version... Made "Settings" property Auto-Init.

Jaben wrote:

A much better solution than mine! Thank you Jaben.