Copied to clipboard

Flag this post as spam?

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


  • Matthew Berner 2 posts 72 karma points
    1 week ago
    Matthew Berner
    0

    Check to see if a specific member id is online

    We have a chat application, we want to check to see if a specific Member ID is online to chat. I can only find information on getting a current Member ID to check to see if they are online. Is there a way to find a specific member id and see if they are online.

    Is this something that Member Services can do?

    Thanks

  • Dennis Aaen 4459 posts 17972 karma points admin hq c-trib
    1 week ago
    Dennis Aaen
    0

    Hi Matthew and welcome to Our

    You will be able to find the member by ID. See this link for reference

    https://our.umbraco.com/apidocs/v8/csharp/api/Umbraco.Core.Services.IMemberService.html#UmbracoCoreServicesIMemberServiceGetByIdSystemInt32

    /Dennis

  • Matthew Berner 2 posts 72 karma points
    1 week ago
    Matthew Berner
    0

    Dennis:

    Would we be able take that Member ID then and check and see if that Member ID is online?

    Thanks for the quick reply.

  • Huw Reddick 410 posts 1097 karma points
    6 days ago
    Huw Reddick
    0

    You can check if a user is online using code similar to below

        IMember member= memberService.GetByEmail("someemailaddress");
        MemberShipUser user = Membership.GetUser(member.Username);
        bool online = user.IsOnline;
    
  • Dennis Aaen 4459 posts 17972 karma points admin hq c-trib
    1 week ago
    Dennis Aaen
    0

    You are welcome Matthew

    You can find differens Umbraco helpers here https://our.umbraco.com/documentation/reference/querying/umbracohelper/#working-with-members there are different once, some of them are for members

    Hope this helps,

    /Dennis

  • EdwardWelch 1 post 71 karma points
    6 days ago
    EdwardWelch
    0

    Yep, that it always help :D

  • iNETZO 101 posts 427 karma points
    6 days ago
    iNETZO
    0

    Hi Matthew,

    As far as I know there is no built-in functionality for this. It also depends a lot on what your definition of being online is. That the member has the page actively open, or that the member has recently opened a page?

    For real-time things like chat applications I would rather use websockets I think. Or another solution could be to use ajax to call a controller every x seconds that does something with the memberid, such as caching it in a list and clear the ones that have not been active since a while.

    Best regards,

    iNETZO

  • Paul Seal 443 posts 2413 karma points MVP 3x c-trib
    6 days ago
    Paul Seal
    0

    Hi Yeah some sort of keep alive ping would be a good solution here. Although you might need to get permission from the user before you capture this info.

    Then if you have a table of ids and last ping datetime you can get an idea of who is or was recently online. You can clear this table of people who haven’t been online in the last however x many minutes to stop it getting bloated

Please Sign in or register to post replies

Write your reply to:

Draft