Copied to clipboard

Flag this post as spam?

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

  • Craig O'Mahony 363 posts 917 karma points
    Dec 05, 2017 @ 16:08
    Craig O'Mahony

    Get last login date for members through SQL

    Hi all,

    I'm using Umbraco 7.6.4 and I'm attempting to retrieve through SQL the last login date for my site members. I'm using the following SQL

    SELECT MEMB.LoginName, MEMB.Email, MEMBDATA.[datadate] AS LastLoginDate, membdata.* FROM UmbracoICA.dbo.umbracoNode AS MEMBTYPEID INNER JOIN UmbracoICA.dbo.cmsContent AS MEMBLST ON MEMBLST.contentType = INNER JOIN UmbracoICA.dbo.cmsPropertyType AS MEMBTYPES ON MEMBTYPES.contentTypeId = MEMBLST.contentType INNER JOIN UmbracoICA.dbo.cmsPropertyData AS MEMBDATA ON MEMBDATA.contentNodeId = MEMBLST.nodeId AND MEMBDATA.propertytypeid = INNER JOIN UmbracoICA.dbo.cmsMember AS MEMB ON MEMB.nodeId = MEMBLST.nodeId WHERE MEMBTYPEID.nodeObjectType = '9b5416fb-e72f-45a9-a07b-5a9a2709ce43' AND = 218 AND LoginName = 'comahony'

    The date that is returned is July of this year but against my actual member data in the back office:

    enter image description here

    Does anyone know how I can pull the last login date please?

    Thanks, C

  • Ben Palmer 166 posts 811 karma points c-trib
    Dec 05, 2017 @ 16:20
    Ben Palmer

    Hi Craig,

    Is there any reason you're doing this with SQL and not the member service? With the member service you could do this really easily if you do something like this:

    var member = ApplicationContext.Services.MemberService.GetById(0);
  • Craig O'Mahony 363 posts 917 karma points
    Dec 05, 2017 @ 16:47
    Craig O'Mahony

    Yes this is powering external reports so there's no direct communication to Umbraco itself or any of it's API's basically a series of cross business data is being collated together and I need to power RS reports directly from the SQL data.

    Thanks, C

  • Satpal Gahir 18 posts 88 karma points
    Feb 25, 2020 @ 14:38
    Satpal Gahir

    did you work out a way of doing this? i have to delete all members where last login is a certain date. i can do this via the member service.....but it would take a long time.

Please Sign in or register to post replies

Write your reply to: