User Likes

Where are likes stored in the database please e.g. what tables and what columns. Ideally I'd like to be able to extract the total number of likes per user regardless of what thread they made which is liked or reply which is liked of blog post made which is liked etc. I can extract the values if someone can point me in the right direction as to table and column definition and/or frequency that likes are added via any job scheduler task. Cheers. P :)
  • A quick scan of the database and SPROCs makes me believe they are stored in te_Content_ContentUserLikes - It appears there are the following columns:

    LikeId

    ContentId

    LikeTypeId (I have no idea the different types of likes)

    CreatedUserId

    CreatedUtcDate

    RowVersionId

    As far as frequency..I am not sure on that, but am guessing it is as soon as the user presses the "Like" button

  • In reply to Phil Chouinard:

    There is a widget called "Liked Content" which displays all likes for a user.  It uses the below method which returns a "PagedSet" of "Like"- The PagedSet object does have a "TotalCount" field.  The only bad part is that if you want to get the total like count for a batch of users, you'd have to execute this multiple times which would not be very efficient.

    #set($pagedListResponse = $core_v2_like.List("%{ApplicationId = $applicationIdArg, ContainerId = $containerIdArg, ContentId = $contentIdArg, ContentTypeId = $contentTypeIdArg, ContentUrl = $contentUrlArg, PageIndex = $pageIndexArg, PageSize = $pageSizeArg, SortBy = $sortByArg, SortOrder = $sortOrderArg, TypeId = $typeIdArg, UserId = $userIdArg}"))

    If you want to run a SQL query across a set of users, you could do something like:

    Select Count(*), CreatedUserId from te_Content_ContentUserLikes
    <Where Clauses to filter by date range or content type ids or a set of user  Ids>
      Group By CreatedUserId

    And Yes Patrick, we know this is not supported and would need to be re-done for 8.0 or even a 7.6 hotfix :)

Related