Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm implementing a system which needs to log a timestamp against a member id each time the member logs in. I might then produce a custom section (or probably more likely a new tab in the members section) containing an output of this data.
I realise there are several ways that the timestamp log could be done, so I thought I'd ask people's opinion of the best one. Am I best setting up a custom table, or should I use some kind of custom data type?
Basically, you could just use the default UmbracoMembershipProvider to log the last login date: you can define specific properties of your MemberType to map against the standard "Asp.Net membership Provider" properties. See this link for more info: http://our.umbraco.org/wiki/how-tos/membership-providers/umbracomembershipprovider-properties.
What you will need to do is define a property on your MemberType, e.g. LastLogin, and then map it to your membership provider definition in the web.config file
If you then go to the Members section of the Umbraco admin, you will see that each member has this property defined, and set to his/her last login date. So, as far as I understand your issue, no custom table or data type needed here :-)
Hope this helps.
Thanks Michael, but isn't that just going to record the last log-in? What I need is to log each log-in so for each member the administrator can see a list of each log-in that member has made.
So I did misunderstand your issue :-S It will indeed only hold the last login, not the login history.
I guess the most "Umbraco-friendly" solution would then be to create (or find an existing) a custom data type that can hold a list of dates or something like that, which you can then assign as property to your member type, and fill in the "logged in" event of your login form.
Just for the record, I found a data-type in uComponents which stores multiple dates as a comma-separated string. Since I don't actually need the data type (I just need the log) I implemented a basic version of this of my own, just using a string to store comma-separated dates which updates on the membership log-in event. It's basic, but that's all I need.
Glad you sorted it out. I had actually thought about something similar, but then thought it might not be enough for what you needed :-)
How did you end up solving this ?
I'd happily send you the code but I have no idea which project this was for - it was quite a long time ago. What it sounds like I did was just create a property on the member type, which was a uComponents multiple-date datatype, and append a new record (date/time stamp) to that each time a member logged in, via the member log-in event. I'm not a .NET dev so it must have been pretty simple ;)
If you're having difficulty with this let me know and I'll try to track the code down later this week, but I've had a quick scan and really can't remember where I'd done this (it may even be code that's been superseeded by something else since)
Thank you for replying so fast.
That is exactly what i had plan on doing, from your thoughts above.
When done i will post the source here, so that others can benefid for your idea.
Had to do this in a hurry, and there where was no ex. on the http://ucomponents.codeplex.com/wikipage?title=MultipleDates to read or write the control from .net. So ended up just putting it to a string and apending on that.
Remember to change the provider in the web.config
Old entry in web.config
<!--<add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Alumni" passwordFormat="Hashed" umbracoLastLoginPropertyTypeAlias="last_login" />-->
<add name="UmbracoMembershipProvider" type="Alumni.Web.events.CustomUsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Alumni" passwordFormat="Hashed" umbracoLastLoginPropertyTypeAlias="last_login" />
Can you add the code for the member type you created? I am trying to create the same log history and figure out how to do it.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted