I want to make a special section on a users profile page that will show a count of how many of each content type they have contributed and then link to those nodes. So it might show:

Pictures: 23
Blogs: 53
Pages: 4

And clicking on the numbers will return those pages. I can do the linking to the nodes easy with views but how do I get the count, and will that be too resource intensive to show on someones profile page?

Comments

mooffie’s picture

I can do the linking to the nodes easy with views but how do I get the count,

Use Views for this as well.

You have to create only one view, for all your needs.

Your view should get two arguments: the user id, and the node type (specify the view's URL as 'user/$arg/typestats'.)

In the node-type argument's default action drop-down choose "summary". When the argument is missing, View will display a summary which consists of one line for each node-type. Each line contains the node-type name, then the number of nodes in it.

j0k3z’s picture

Hmmm, I cant seem to get it to work properly.

It keeps telling me page not found. I know I set it up properly because I use views for EVERYTHING and know how to setup views properly. But for some reason this one is not working.

mooffie’s picture

Could you "export" the view and post it here?

And what exactly did you type into your browser's URL field?

I've just tried the plan I gave you and it works. But, for some reason, I first had to clear Drupal's cache for it to recognize my view. Probably a menu issue. Strange. (To clear your cache, empty all cache_* DB tables, or install the 'devel' module -- it can do this for you.)

j0k3z’s picture

all of my views are showing Page Not Found

Any idea why this might happen? Not sure what I did but they were all working before

Rosamunda’s picture

I cannot get this stuff working. Maybe I want something different:
I´m using Usernodes, so I need a link or a block that appears there (in each usernode, as a profile), showing all that certain usernode´s author comments. I would like to show all comment´s titles.
How can I do that?

1. I´ve created a block view.
This block has this code (at the block usability´s area... show block if PHP code is true...)

$match = FALSE;
$types = array('Usernode' => 1);
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid));
  $type = $node->type;
  if (isset($types[$type])) {
    $match = TRUE;
  }
}
return $match;

2. The View has this options checked:
Block: Show as table
Fields: Comment Subject
Arguments: User: UID is Author: Show all values
Arguments: Node: Type: Summary unordered
Filters: Node: Type: Flexinode_X
Filters: Role: Author´s Role is: XX

3. Now, I cannot get the page to work properly, nor the block to appear.
The page´s name is "my_comments"
I´ve tried the $arg tip that you have pointed out, but that sends me to my own user profile.

I´ve tried several options at the Views config page, but it never appears as I want.

Could anyone help me? :-)

Thanks in advance!!!!

Rosamunda
Buenos Aires | Argentina
www.ligadelconsorcista.org

Equ’s picture

Could you provide more detailed answer, please? I also need this functionality but have no clue how to do this...

T-34@drupal.ru’s picture

The solution is not found?

mkumtystentkris’s picture

Ну как всегда радуете своими необыкновенными постами