1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / User's Last Activity being updated in some stored procedure.

User's Last Activity being updated in some stored procedure.

6 posts, 0 answered
  1. Adeel Arif
    Adeel Arif avatar
    27 posts
    Registered:
    30 Dec 2009
    25 May 2010
    Link to this post

    Hi Guys,

                Hope you are all fine. Recently I encountered a very strange problem; I was working on a face book like chat module in sitefinity. Now to get the online users I use the standard asp.net way. But there seem to be a stored procedure which updates the last activity time of the user making him online (Only those users who have posted the last comment in a forum)

    When I make the visibility of the below to “FALSE” the problem seems to go away.

    But then the last comment disappears….

    <prof:ManageProfile ID="lastPostAuthor" runat="server" ShowAnonymousLabel="true" AnonymousLabel="<%$ Resources:Anonymous %>">

                                <ViewTemplate>

                                    <asp:Literal ID="FirstName" runat="Server"></asp:Literal>&nbsp;

                                    <asp:Literal ID="LastName" runat="Server"></asp:Literal>

                                </ViewTemplate>

                            </prof:ManageProfile>

    The above code seems to be the source of the problem as profile of the users are being fetched which ultimately results in updating of the last activity date, showing the user online.

    I was also curious about which stored procedure is invoked bay Profile.GetProfile(username) method, normally the asp.net stored procedure is invoked is there any change?????

    So guys any suggestions???

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 May 2010
    Link to this post
    Hello Adeel Arif,

    The built in manage profile control is used for updating user profile info. We use standard ASP.NET membership, profile and role providers. The last activity time stamp of the currently logged in user will be updated if you use the manage profile control and change the user profile. If you wish to show profile info you can extend the Login View control or create a view profile control which will not have the capability to edit user profiles.

    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Adeel Arif
    Adeel Arif avatar
    27 posts
    Registered:
    30 Dec 2009
    25 May 2010
    Link to this post
    Can you please provide a sample code on how to extend the login view control , i want that the default functionality of the forums control stay the same only that it should not update the last time stamp of the user who has posted the last comment but i want that his name should be displayed the same as in forums control that is the last comment author name should be displayed.

    thanks ,

    regards
    Adeel Arif
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    25 May 2010
    Link to this post
    Hi Adeel Arif,

    You can add aditional labels in the LoggedInTemplate and then populate them with user profile information on load.

    All the best,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Muhammad Saqib
    Muhammad Saqib avatar
    95 posts
    Registered:
    09 Sep 2009
    26 May 2010
    Link to this post
    I found a workaround which will not update the last activitydate when Profile.GetProfile(username) is called.
    But I cannot find this store procedure in Sitefinity database. The SP is "aspnet_Profile_GetProperties".

    http://leedumond.com/blog/how-to-prevent-profile-properties-from-updating-a-users-last-activity-date/

    So the problem is whenever i call Profile.GetProflile(username).. that username's last activitydate is updated , which i do not want to..

    any workaround?
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    26 May 2010
    Link to this post
    Hello Muhammad Saqib,

    You can add a stored procedure similar to this one on your Sitefinity database and then call it to get the profile data. The stored procedure should look something like this:
    USE [SitefinityDev]
    GO
    /****** Object:  StoredProcedure [dbo].[GetProfile]    Script Date: 05/26/2010 10:27:00 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[GetProfile]
        -- Add the parameters for the stored procedure here
        @UserName nvarchar = 'test',
        @ApplicationName nvarchar = '/'
    AS
    BEGIN
        DECLARE @ApplicationId uniqueidentifier
        SELECT  @ApplicationId = NULL
        SELECT  @ApplicationId = ApplicationId FROM dbo.telerik_Applications WHERE LOWER(@ApplicationName) = LoweredApplicationName
        IF (@ApplicationId IS NULL)
            RETURN
        DECLARE @UserId uniqueidentifier
        SELECT  @UserId = NULL
        SELECT @UserId = UserId
        FROM   dbo.telerik_Users
        WHERE  ApplicationId = @ApplicationId AND LoweredUserName = LOWER(@UserName)
        IF (@UserId IS NULL)
            RETURN
        SELECT TOP 1 PropertyNames, PropertyValuesString, PropertyValuesBinary
        FROM         dbo.telerik_Profile
        WHERE        UserId = @UserId
        --IF (@@ROWCOUNT > 0)
        --BEGIN
        --    UPDATE dbo.aspnet_Users
        --    SET    LastActivityDate=@CurrentTimeUtc
        --    WHERE  UserId = @UserId
        --END
    END


    Best wishes,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
6 posts, 0 answered