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 4 posts 104 karma points
    Apr 29, 2021 @ 19:50
    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 4500 posts 18255 karma points admin hq c-trib
    Apr 29, 2021 @ 20:07
    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 4 posts 104 karma points
    Apr 29, 2021 @ 20:11
    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 1929 posts 6697 karma points MVP 2x c-trib
    May 02, 2021 @ 12:33
    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 4500 posts 18255 karma points admin hq c-trib
    Apr 29, 2021 @ 20:18
    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
    May 02, 2021 @ 01:42
    EdwardWelch
    0

    Yep, that it always help :D

  • iNETZO 134 posts 497 karma points c-trib
    May 02, 2021 @ 10:09
    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 524 posts 2889 karma points MVP 7x c-trib
    May 02, 2021 @ 13:56
    Paul Seal
    100

    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