Looking for detail about users and contacts

Tom Troughton asked on September 10, 2015 18:12

I'm hoping someone can provide some advice about the relationship between users and contacts. I understand these as separate concepts, but what I'm not clear about is their relationship.

For example, I want to build a custom 'My Account' page where my users can add/update some personal details. The User object itself does not contain certain personal info like address. I assume this is because that data is held in an associated Contact. So does this mean that once a user is registered there's a 1:1 relationship between that user and a particular contact? If so I haven't found anywhere that obviously associates these two object types. Or would I be expected to customise the User object to include these personal fields and then map them to Contact using the On-line marketing tab of the User class in Modules/Membership? In which case my 'My Account' form would only ever be updating the authenticated User object via the API.

Any advice would be appreciated.

Recent Answers

Brenden Kehren answered on September 10, 2015 18:20

Users = authenticated people need a username and password. Contacts = information from people who visit your site without logging in or creating a user account.

You can typically link a user and a contact with forms. For instance I can create a contact us type form and have it specifically require first, last and email address. Then in the form itself, I map them to the contact field. All we've gained now is a contact. Once that user goes shopping and goes to check out, we require a username to proceed so they can track their order. At that time the contact and the user are then linked in the background.

What you'd do is create a page for them to modify their user account (authentication info) on. Then on another page you'd create to allow them to manage their demographic information on. The form on this demographics page, will override any other contact data (as long as you check that box in the field mapping). This is their primary place to update that contact info. There may be a webpart for this already but don't remember off the top of my head.

0 votesVote for this answer Mark as a Correct answer

Tom Troughton answered on September 11, 2015 10:25

Thanks Brenden. Everything you say makes sense, except for one key thing. Although a User and a Contact are separate concepts functionally, of course they both in reality represent a human being using your website. Since a user and their demographic properties both represent the same real world entity, I had expected a more formal link between them in the database/API.

For example, in the API how might I write a method which, for a given user account, returns their demographic profile (from the associated Contact record)?

My concern is about how Kentico maintains this link between a user and their contact data. For example, say one of my users clears all their cookies and revisits under a different IP address, does Kentico still know which is the correct contact record?

After writing this I looked at the OM_Contact table and can see a ContactOwnerUserID field. I wonder, does this mean a form with fields mapped to the Contact object will actually, if a User is authenticated, update all OM_Contact records with that user's ID in the ContactOwnerUserID field?

Another question is, why do User and Contact share some fields, for example both have a first name and last name? How does Kentico ensure these are always kept in sync?

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.