Copied to clipboard

Flag this post as spam?

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


  • bayshield 50 posts 65 karma points
    Jun 20, 2011 @ 17:42
    bayshield
    0

    User owned content - best practice

    Hi

    I am creating a community website where when a user joins they get a profile page that they can update.  I have created a doc type for the profile page and a user control that can edit the data in the document.

    What I want to do now is to modify the profile template so that if a logged in user visits their own profile page, they should see an edit button.  I can easily check if a user is logged in, but what is the best practice way of identifying whether the page belongs to that member? 

    Should I do something as simple as adding an extra attribute to the profile doc type tostore the members user id, or is there a better way of doing it in Umbraco?

    Thanks in advance for your help.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 21, 2011 @ 09:09
    Dirk De Grave
    0

    bayshield,

    it should be one of your options and probably the easiest to implement. If the profile edit template page is different from the profile page, you could use the public access feature (you could set the public access programmatically using the api), but still think this would be some overkill here.

    I'd go with your solution, most straightforward to implement imho.

     

    Cheers,

    /Dirk

  • bayshield 50 posts 65 karma points
    Jun 21, 2011 @ 10:13
    bayshield
    1

    Thanks for the response Dirk.  I ended up doing it that way last night using Razor and it was really easy.  Now when a user signs up, i programatically create the profile page, set thier username and then just check in the front end using the code below.

    @if(@User.Identity.IsAuthenticated && @User.Identity.Name == @Model.userName)
    {
     //Display editing options here.
    }

Please Sign in or register to post replies

Write your reply to:

Draft