0

I am building a site where users can posts articles, blog posts, comments and more. I want to create a page, that will contain Info on all the registered users in the site, and their contribution.

I created a view, but I am having problems using the Aggregation function of Views, and count the number of times a user wrote each content type. I don't know how to count different content types, per user.

In addition, in case of a user that didn't post articles, I want the result will be zero (0). Currently, for some reason, the content type does not appear at all, if the count is zero.

Here is an example of what I am trying to accomplish:

  • Picture
  • John doe
  • articles: 0
  • Blog posts: 2
  • comments: 5

  • Picture
  • Emily doe
  • articles: 1
  • Blog posts: 0
  • comments: 3

Any suggestions or solution?

  • Hello. Is your problem about creating a page that will contain data, or is it really about getting data from the database to put it on page? – Mołot Sep 27 '13 at 23:19
  • I Think both. I think that I understood the basic of aggregate, but, as I mentioned, I don't know how to count the number of each content types (articles, post, comments) per user, and present all the data, in one page, even if the result is zero (0). I will be happy to here any suggestions or solution? – EB84 Sep 28 '13 at 8:02
  • It would be a very heavy calculation if you use views for this purpose. I would recommend you to create separate fields as a counter to store the numbers. You can use rules to update the counter when user create new contents and delete contents. – Jimmy Ko Jul 19 '16 at 14:18
0

This question is quite old, but we should link to the right places for any one still landing here:

Since this question is from 2013: The most common way to accomplish this in Drupal 7 was to use the Views module in combination with its inbuild aggregation feature for this purpose. (JFYI: The Views module is in core now since D8 btw and provides the default frontpage listings including count of comments, etc.) Also take a look at the Views module example pages provided by default, like the Taxonomy term overviews, Glossary or Tracker, which shows you how to achieve this.

I also recommend to read thru regarding Views module questions here, since this question has been answered many times here on DA.

Hope it helps ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.