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

Forums / Developing with Sitefinity / How do I get all comments for a user of a specific type?

How do I get all comments for a user of a specific type?

1 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    12 Aug 2014
    Link to this post

    This is what I'm gonna assume

    public static List<LatestCommentProxy> GetRecentReviewsForUser(Guid userId){
        List<LatestCommentProxy> commentsList = new List<LatestCommentProxy>();
     
        // Get the comment
        var manager = SystemManager.GetCommentsService();
     
        var groupKey = ControlUtilities.GetUniqueProviderKey("Telerik.Sitefinity.DynamicTypes.Model.Resources.Resource", "OpenAccessDataProvider");
        var threads = manager.GetThreads(groupKey);
     
        foreach (var thread in threads)
        {
            var filter = new CommentFilter();
            filter.AuthorKey.Add(userId.ToString());
     
            var comments = manager.GetComments(filter);
            foreach (var c in comments)
            {
     
                commentsList.Add(new LatestCommentProxy(c, thread));
            }
        }
     
        return commentsList;
    }

    ..."Telerik.Sitefinity.DynamicTypes.Model.Resources.Resource" comes from the MB Type (comments type as well)

     There's clearly reviews\comments against that type, but "threads" returns 0

1 posts, 0 answered