Hello,

I have searched through the posts and have found where questions on this were asked but never a full answer given. So here goes my attempt! ...

I want to be able to setup views for listing audio nodes against specific users.

For example... "List all audio from Bob" or "John", etc...

I guess I need to pass the UID into the views args. I have found where you mentioned before to use in the arg handler this:

------
if (arg(0) == 'user' && is_numeric(arg(1))) {
return array(arg(1));
}
------

However, that does nothing by itself. I am not sure what I need to add for the main arg or filter so that I get only audio nodes that belong to a specific user that I have passed into views with args.

I really need to do this badly so your help is greatly appreciated!

Comments

lias’s picture

Hi, I was using the same code you posted to list a user's images on a single node page that the user created. Except it loaded all user images.

What worked, after much searching and trying out, was using the following code in the argument handling code:

if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(2) && ($node = node_load(arg(1))) && $node->type == 'usr_gallery') {
  return array($node->uid);
}

Change 'usr_gallery' to the content type where you want it to display.

And use User: UID Authored or Commented for argument type.

sun’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.