Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • monster 13 posts 33 karma points
    Aug 27, 2010 @ 14:32
    monster
    0

    history of propertydata

    Hi

    I am new to Umbraco and just have some questions.

    So I have up a basic website that make use of the umbraco membership provider. I have added some custom properties to the member type. lets say firstname and lastname. now what i would like to know is how do i make umbraco keep history of the values that are entered into those fields.

     

    so for instance, a user has the name 'bob', but then you go and change it to 'fred'. i want to be able to see bob still in the database. from what i can determine, the propertydata table only keeps the latest value and gives it a versionid. you see this may seem trivial with regards to a name, but if lets say it was a persons address, i want to be able to see history of the address.

     

    this question does not only apply to members but all propertydata that i may keep on my umbraco site(s). i like to be able to go and look at any point in history and retrieve that value.

     

    is this ability built into umbraco using the properties, or do i have to build something custom?

     

    thanks in advance

  • Sascha Wolter 615 posts 1101 karma points
    Aug 27, 2010 @ 16:11
    Sascha Wolter
    0

    Hi monster,

    by default nothing ever gets deleted on the content side of things, all the previous versions are retained. I would have thought that this happens in the propertydata table, yet that doesn't seem to be the case. Anyway, if you right-click any content node in Umbraco and click on Rollback you can see all published versions of that page right back to when it was created. So the data is definitely somewhere in the database.

    If you want to be 100% sure and you have high requirements for auditing for the new web site you might think about adding your own logging mechanism to it, e.g. on the publish event. There are a couple of logging frameworks out there which apparently work quite nice with Umbraco.

    Hope that helps,
    Sascha

    [Edit: it does seem to be in the cmsPropertyData table. I have a property type 'mainImagePromoCopy' with id = 69 that is just used on the homepage. Executing

    SELECT *
    FROM cmsPropertyData
    where propertytypeid=69

    returns

    id    contentNodeId    versionId    propertytypeid    dataInt    dataDate    dataNvarchar    dataNtext
    154842    1052    5AA42109-2BFB-4592-B984-1425827C1227    69    NULL    NULL    NULL   
    155761    1052    C9B571A8-68B5-4F5C-8552-E2866316BE8C    69    NULL    NULL    NULL    Our new teen drama starts *************
    155806    1052    8DC2E90C-BF75-447D-A81F-B385122F2673    69    NULL    NULL    NULL    Our new teen drama starts ************
    155876    1052    15216C21-7FF1-4E53-84B4-BE653DAF88CD    69    NULL    NULL    NULL    Our new teen drama starts *************
    155921    1052    D2C2C316-A3C5-46C1-8F4F-900896561255    69    NULL    NULL    NULL    Our teen drama showing on *************
    156086    1052    4A69EDAE-AFFA-4517-97D8-FBE8BF08C418    69    NULL    NULL    NULL    Our teen drama showing on ****************
    156131    1052    D7CA8A04-EAEC-4BC8-ACB5-71C576AC8982    69    NULL    NULL    NULL    Our teen drama begins on ****************
    156176    1052    309780FD-C4FC-43BA-B79B-C0D72C461DFF    69    NULL    NULL    NULL    Our teen soap begins on ***********
    156221    1052    9305D461-C222-4C14-96B2-871C466A5754    69    NULL    NULL    NULL    Our teen soap begins on *******************
    160910    1052    643EB56F-1DEA-4BC6-ADAC-C657CCA32E77    69    NULL    NULL    NULL    Our teen soap begins on **********************]

     

  • monster 13 posts 33 karma points
    Aug 30, 2010 @ 12:27
    monster
    0

    Hi Sascha

     

    Thanks for the response!

     

    I did notice that some data is kept, but member data seems to just be updated. So if a member updates their details then your lose the history....i will have to make my own custom membership properties and store it seperately, kind of annoying because umbraco supposed to make this so easy, the beauty of just adding a property from umbraco for your member type is lost as there is no history kept.

     

    I have another question that you could maybe help me with also to do with members.

    Is there a way to link a member to a user. In other words, a user can go and browse and log into your front end for instance. My main objective here is to allow my cms users to affect changes as a member on the front end but to have a clear indication that they are in fact the same person. Although this is not something that is critical to me it would be nice to have your thoughts on this :)

    Thanks again,

    M

     

  • andrew shearer 512 posts 661 karma points
    Aug 31, 2010 @ 03:08
    andrew shearer
    0

    high 5 Sascha. (sorry, i can't vote normally yet)

     

  • Sascha Wolter 615 posts 1101 karma points
    Aug 31, 2010 @ 16:46
    Sascha Wolter
    0

    Hi monster,

    The reason why member data is not versioned is probably because the ASP.Net membership is used in the backend and that doesn't come out of the box with versioning. Although it would be possible to write some mechanism to do this it might be a bit heavier lifting (although maybe you could try a database trigger?).

    Anyway, to your second question: you should be able to create a link of some kind between a user and a member. E.g. create a custom datatype by using the usercontrol wrapper which displays a list of users in a drop down list. You can then put a new field to the members where you can select which user corresponds to it. On the frontend or your custom controls you can then follow the link from the member to the user. Obviously you'd have to generate the drop down list of users yourself by using the umbraco dlls, which shouldn't be too problematic, and also it will be much easier to only do a one way association as you can easily add new properties to the members but not so much to the users.

    Hope that helps,
    Sascha

     

    @andrew: thanks :)

     

  • monster 13 posts 33 karma points
    Sep 01, 2010 @ 10:17
    monster
    0

    Hi Sascha,

     

    Thanks a mil for the response. Very helpful.

     

    I had thought of the database trigger idea and it seems like a really quick yet effective option.

     

    As for the custom datatype, that makes a lot of sense...thanks.

     

Please Sign in or register to post replies

Write your reply to:

Draft