so i've been working on some forum functions (basically extending alloytech stuff), and i want to get the number of posts one user has made.
I'm currently trying to use FindpagesWithCriteria:
As for the criterion, this will give me no result:
_criterias.Add(Manager.CreateCriteria(CompareCondition.Equal, "CreatedBy", PropertyDataType.String, Page.User.Identity.Name, true));
While this one does:
_criterias.Add(Manager.CreateCriteria(CompareCondition.Equal, "PageTypeName", PropertyDataType.PageType, Manager.PostPageTypeName, true));
Has anyone dealt with this?
The type of PageTypeName is not PropertyDataType.PageType. To use PropertyDataType.PageType, use the property name PageTypeIDand the page type's ID, like here in the SDK. PageTypeName would be string, if it's even possible to search for.
Hmm, actually, i want to filter the pages by user. I'd like to count how many posts one has made, and his latest replies.
I don't know why that first criterion doesn't work.
Oh, sorry, I read it backwards and my answer is completely incorrect...
Try chaning "CreatedBy" to "PageCreatedBy". All (well, almost...) the default properties are prefixed by "Page" in the database.
Oh, great, that works like a charm.