Copied to clipboard

Flag this post as spam?

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


  • Jan Fosgerau 65 posts 89 karma points
    Nov 30, 2009 @ 14:10
    Jan Fosgerau
    0

    Member using the properties on page

    Hey there.

    ive managed to make a user in member under a member group and have restricted a specific page to only be opened by this group.

    now i would like to add some info on this page concerning my member.

    my user has been given some properties

    Name / Lastname / Addresss .etc.etc.etc

    now i would like to use these properties on the page - i tried to put them in a template like so.

    1  <umbraco:Item field="username" runat="server"></umbraco:Item><br />
    2  <umbraco:Item field="userlastname" runat="server"></umbraco:Item><br />
    3  <umbraco:Item field="useraddress" runat="server"></umbraco:Item><br />
    4  <umbraco:Item field="useretcetc" runat="server"></umbraco:Item><br />
    5  <umbraco:Item field="useretcetc2 runat="server"></umbraco:Item><br />
    6  <umbraco:Item field="useretcetc3" runat="server"></umbraco:Item><br />

    just to get the properties out to work with.

    but nothing is returned.? 

     

    i would like to know how to use these properties on my site so that the page shows the info of the logged in user.

    also i would like to know how to make a macro that lists pages (IF your logged in) that you have access too.

    right now my page lists everything on the site even the pages locked off. (they cant be entered) but i wanna only show them if your logged in.

     

     

    any help would be really appreciated.

     

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 30, 2009 @ 15:08
    Dirk De Grave
    0

    Hi Jan

    Member details cannot be retrieved this way. You need to use other methods to get member details. Have a look at the membership functions here on the wiki section. (As umbraco depends on asp.net membership, you should be using this api).

    For a quick (and non optimized) way to get member details, use Member.GetCurrentMember() from within a template or umbraco.libary:GetCurrentMember() from xslt (Mind the semicolon instead of dot) --> not recommended tho

    If you need to find out whether a member has access to a specific page, use isProtected() and hasAccess() from xslt and the Access api from .net code

     

    Hope this helps.

    Regards,

    /Dirk

     

Please Sign in or register to post replies

Write your reply to:

Draft