Query Topics by Users

Pål Malmberg
Member since: 2008
I have a problem when I want to make a query in forum.
I want to find all topics in a forum posted by users that have an attribute "group01".

As I see it I can make Queries where I can filter the Topics by Author but not by Users where I have some attributes. Do I have to connect Author and User in some way?
#27718 Feb 09, 2009 10:46
  • Helena Callert
    Member since: 2006

    Hi Pål,

    I had a similar problem and solved it by using a UserAuthorCriterion to filter on the User attribute:

    UserAuthorCriterion criterion = new UserAuthorCriterion();
    criterion.User = new UserCriterion();
    criterion.User["Attribute"] = new IntegerCriterion();
    ((IntegerCriterion)criterion.User["Attribute"]).Value = attributeValue;

    TopicQuery topicQuery = new TopicQuery();
    topicQuery.Author = criterion;

    Maybe there are other ways of doing it but this seems to work fine for me.

    Best regards,

    #27743 Feb 09, 2009 11:40