Copied to clipboard

Flag this post as spam?

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


  • Mouhot 9 posts 29 karma points
    Aug 02, 2010 @ 12:17
    Mouhot
    0

    How can I retieve the umbracoLastLoginPropertyTypeAlias property?

    I need to display the member's last login date onto my website.

    I have seen here (http://our.umbraco.org/wiki/how-tos/membership-providers/umbracomembershipprovider-properties) that Umbraco can store this value but I was wondering how can I get this value back ?

    cheers !

     

     

  • Sascha Wolter 615 posts 1101 karma points
    Aug 02, 2010 @ 13:46
    Sascha Wolter
    0

    Hm, I would guess there is an attribute on the member node xml, like 'lastLogin'? Have you tried

    <textarea>
        <xsl:copy-of select="umbraco.library:GetMember(some-member-id)" />
    </textarea>

    to see what attributes are included when you set the parameter in the web.config file?

    As an alternative you should be able to write your own XSLT extension that grabs the property from the member object.

    Sascha

  • Mouhot 9 posts 29 karma points
    Aug 02, 2010 @ 14:15
    Mouhot
    0

    Hi Sascha,

    actually you are right. It wasn't working because i forgot to add the LastLogin property to my member type. My mistake!

    but now I have a new problem... The last login date is shown after the user is logged in. So it actually gives me the current date. What I am looking for is, in fact, the previous login date. How can I read (and store) this date before it is overwriten ?

     

  • Sascha Wolter 615 posts 1101 karma points
    Aug 02, 2010 @ 16:08
    Sascha Wolter
    0

    Hi Mouhot,

    I guess you are logging in the user via an ASP.net login control? If so I suggest you hook up to e.g. the 'OnLoggingIn' event of the control in a .Net user control and get the details of potential user before he gets actually logged in, by taking the entered username and using the umbraco.library method (something like GetMemberByName). Then you could read out the value and store it e.g. in a Session variable for later use e.g. in an Xslt script.

    However you need to take into account that you would get the details before the user actually logs in, which means the user is not authenticated at that time and if he doesn't authenticate you would have either not found a user with the username anyway or retrieved the last log in value unnecessarily (which should be okay though).

    Hope that helps,

    Sascha

     

  • Mouhot 9 posts 29 karma points
    Aug 02, 2010 @ 16:16
    Mouhot
    0

    I have just finished my login page which displays the last login date on logged in.

    I actually did what you suggest. I have overwritten the ValidateUser method. juste before calling base.ValidateUser(usn, pwd), I check if the user exists and, if so, I save the LastLogin date and save it in a session variable that I then directly read from xslt

    <xsl:value-of select="umbraco.library:Session('LastLogin')" />

    it seems to be working pretty well!

     

    cheers

  • Sascha Wolter 615 posts 1101 karma points
    Aug 02, 2010 @ 16:26
    Sascha Wolter
    0

    Hurray, that's great. :)

Please Sign in or register to post replies

Write your reply to:

Draft