Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Extending profile/user classExtending profile/user class
Previous
 
Next
New Post
5/9/2007 12:17 PM
 
Hi there,

I try to figure this out for a week now, maybe someone can help me. The thing is that I try to extend the user profile class of the core (because it should save and show historic data and compute input from multiselects as well).

Anyway, what I try to figure out is, how to extend it with the least changes to the code. I had some ideas which all didn't work out:
a) Extend the core directly -> not good, problems when upgrading
b) Build a seperate project which inherits most of core -> ascx/vb files all have to be corrected in order to point to new 'XProfileController'

Is there a proper/elegant way?

I appreciate any help, thank you!
 
New Post
5/9/2007 2:12 PM
 

Yes, try, unless absolutely nessesary, not to touch the controllers (UserController/UserInfo) because the upgrade will wipe out your code...and then it can be a pain to put it back and it might not work correctly...

Option B, might work, if you inherit the "Info" class you might be able to add on to it, but you will still have to update the Controller in order to add the fields to the db.

I had the same issue...What we did was buy a module called "Dynamic Registration", in which you can create a registration form with any amount of fields and you can map the fields to the core field or a new custom field can be created.  We liked it until we wanted to update it for what we needed...No offense to the developer, but the code might have be fine a long time ago (v1) but it has been added on to so much the code is very "spagetti" and very inefficient.  What this module does though, is even know it is mapped to a core field (say "First Name") the module keeps a copy of the data in its table also...So there is double user data.

So we ended up creating our own module based on the same idea, but to suit our needs better.  I wish I could sell you our module, but it is an "in-house" only module.  I made it so that you can use core and custom fields, but when storing the core fields, they are only store in the DNN User tables and the only data in my tables were any custom field responses.  Follow me?  I also added on field "visibiliy" so the user can show or not show the data to other users on the "member profile" page.

So the long and short of it is...
If you don't think you will need to update the code a lot and you need it right away, go buy the "Dynamica Registration" module.

If you want total control and you have time, build it.

Hope this helps ya a little

 
New Post
5/9/2007 3:17 PM
 
Thanks very much for you detailed reply.
I kinda oped that there would be an option C where you sort of "override" the existing ProfileController. But apparently writing a XProfileController, which extends the usual Controller seems to be the only way, doesn't it?
 
New Post
5/9/2007 9:16 PM
 

stephanos wrote
Hi there,

I try to figure this out for a week now, maybe someone can help me. The thing is that I try to extend the user profile class of the core (because it should save and show historic data and compute input from multiselects as well).

Anyway, what I try to figure out is, how to extend it with the least changes to the code. I had some ideas which all didn't work out:
a) Extend the core directly -> not good, problems when upgrading
b) Build a seperate project which inherits most of core -> ascx/vb files all have to be corrected in order to point to new 'XProfileController'

Is there a proper/elegant way?

I appreciate any help, thank you!

 

If all you want is history - you might add some database triggers on the table you want history for that updates an audit table on any change.

otherwise, you'll be creating two different things:  A profile provider, and a User page.

For the profile provider, you can do anything you want, then change out the line in the web.config to point to your new provider.  it needs to conform to the expected signatures - not too difficult to do.

For the user page, it's a bit tricky because it needs to be one single module that handles:  new user registration, profile updates, password changing, subscription changing, admin edits of user accounts....   you can pick apart the one thats there to figure out how.  If you email me privately and are not in a competing industry; i'll send you the code that I've written to create the user registration seen at http://www.skydivechicago.com.

Beware - it's not a two day job.  It took me about a month of work to really get everything down (granted, the project included a lot - cross application login took a lot of the time.)  My code might save you a week of time; but the down side to how i do things is that it isn't 'configurable' after the fact - changing registration would require code changes.

If you decide you want to hire the work out, look me up; i've got a bunch of experience in that area of the code and so my time estimates are likely to be shorter than most.  Or if you just want a boost; we can spend an hour or two on a netmeeting and I can give you a 'tour' of what I had to do and why.

Cheers

 
New Post
5/10/2007 7:50 AM
 
Well, thanks a lot for your post! Maybe if I get stuck I come back to your offer!

I like your idea of changing the profile provider, however, I don't think it is enough "customization" for me. I'll give you a "short" idea of my thoughts:

I have different "areas" of profile information, like Interests, Address, Personal Info, Preferences etc. Most of them have historic data and some of them have several values for one property (for instance I have the area Interests which has an interest Sports which consists of Football and Baseball).

So I need to save them properly (thanks for you database trigger idea!) and read them out properly. By reading through the existing code of the core I got the impression that I need to write a new UserProfile and ProfileController for that task. Of course they inherit the existing classes. So far so right?

When thinking about efficiency I also thought it would be better to split the data loaded from the database, so that when the user only wants to see his interests the provider needn't download the address info as well. My impression was, that DNN does the latest, right?

So now having new Controller and Info classes (and new UserModuleBase class as well) I copied the necessary files from admin/Users to a new folder (admin/XUsers) and adjusted all references to the core classes to my new classes (i.e. inherit from XUserModuleBase now). Right?

The thing that worries me the most is redundancy. I may get problems when an update changes the existing admin/Users files, because I had to copy most of them. I thought about splitting the implementations and only changing what I needed (using partial feature?). However, that didn't work out.
Furthermore I am not sure if there might occur problems in other modules, the big DNN framework is mostly still a mystery to me (temporarily the skin didn't work, weird).

I don't know if my current solution is the best way or not. What do you think? Any suggestions?
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Extending profile/user classExtending profile/user class


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out