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.0Query Custom FieldQuery Custom Field
Previous
 
Next
New Post
8/25/2009 2:22 PM
 

I have added a custom field to the DNN registration screen (Admin > User Accounts > Manage Profile Properties)  Is there a way that I can query that directly from SQL (SQL SERVER 2005)?

Also can I add custom validation to that field?  My issue is that our portal has a mobile database associated with it.  Each customer gets their own mobile device, and for warranty purposes we want to track and tie a serial number from a mobile device to a DNN userID.  My hope is to add a custom table filled with valid serial numbers and reference that table when users register.  If they don't type in a valid S/N I need to let them proceed with registration, but note in the table S/N entered.  If that number is already in the table I want it associated to them, and tagged as active so that it can't be used again.

I realize that i am asking a lot, but if I can start by querying the custom field I have some manual work-arounds in mind.  Thank You.

 
New Post
8/26/2009 9:17 AM
 

Well, i'm guessing the database tables might change in future versions of DNN and possibly make your sql-based fetching stuff useless, so i would say that using built in methods such as the UserInfo.Profile.GetPropertyValue(string propName) is a better way to go..

Anyway, using SQL, the custom fields are stored in the ProfilePropertyDefinition table, and their respective values are stored in the UserProfile table.
I'm no SQL guru, but i think this would retrieve the value of the custom field;

SELECT PropertyValue FROM UserProfile
WHERE UserID='the users id'   
[ or perhaps fetch "UserID in ( SELECT UserID FROM Users WHERE UserName='username' )" if you cannot get the id... ? ]
AND PropertyDefinitionID IN ( SELECT PropertyDefinitionID FROM ProfilePropertyDefinition
                              WHERE PropertyName='the custom field name' );


As far as the custom validation goes, i leave that to someone else to answer. I suppose you would need to develop your own validation method or auth.provider, perhaps in conjunction with fetching the custom field value using Userinfo.Profile.... :)

 
New Post
8/26/2009 9:19 AM
Accepted Answer 

To provide validation on the S/N you may need to work with a third party user registration module (use SnowCovered.com to find them, one suggestion might be Datasprings Dynamic Registration; I've never used it though, so can't really recommend it per se).

To query the database, here is a simple query that would allow you to get the value for a property named 'Employee_ID' (as a sample):

select PropertyValue from users inner join UserProfile on Users.UserID = UserProfile.UserID and UserProfile.PropertyDefinitionID = (select PropertyDefinitionID from ProfilePropertyDefinition where PropertyName = 'Employee_ID')

Obviously you'd want to grab a little more information such as the UserID and possibly even more information in your query but at least this serves as an example.


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Query Custom FieldQuery Custom Field


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